Thread: Simple Ncurses-Style Text Graphics for Linux

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by Traiano View Post
    Thanks, Hodor. SDL looks like it will do the trick: You don't need a whole X11 environment to o basic graphics with it, and the documentation looks solid.
    Yeah, give it a go. I have a particular fondness for character-based graphics and also pixel primitives like lines, circles, rectangles, etc (I think they're enlightening things to implement) so just give it a shot and ask questions here on the forum If you want to render text/characters I suggest using a VGA/monospace font (there are lots of public domain ones) and converting it to a C array (that's an additional project) so that you can easily build a simple bunch of functions to display text onto your SDL "canvas". To do this you'll have to first implement a function to set a pixel though, but that's easy with SDL. If you want a VGA font already converted to a C array I can probably give you one; each glyph is simply a w*h region in what's sometimes called a spritesheet. It's not the most efficient way to do things, but who cares

    Edit: You've posted another response. ncurses for the win! I wrote an entire "ascii art drawing library" (and others here might have as well), so go for it.

  2. #2
    Registered User
    Join Date
    Jan 2016
    Location
    Kuwait
    Posts
    5
    Quote Originally Posted by Hodor View Post
    Yeah, give it a go. I have a particular fondness for character-based graphics and also pixel primitives like lines, circles, rectangles, etc (I think they're enlightening things to implement) so just give it a shot and ask questions here on the forum If you want to render text/characters I suggest using a VGA/monospace font (there are lots of public domain ones) and converting it to a C array (that's an additional project) so that you can easily build a simple bunch of functions to display text onto your SDL "canvas". To do this you'll have to first implement a function to set a pixel though, but that's easy with SDL. If you want a VGA font already converted to a C array I can probably give you one; each glyph is simply a w*h region in what's sometimes called a spritesheet. It's not the most efficient way to do things, but who cares

    Edit: You've posted another response. ncurses for the win! I wrote an entire "ascii art drawing library" (and others here might have as well), so go for it.

    For the general benefit of all:

    For learning C through the medium of simple 2D graphics, using a library not requiring an X windowing environment on Linux/FreeBSD, AND well documented, Libncurses5/6 is great.
    To go with it, there is an excellent 579 page tutorial and reference called "The Programmer's Guide to Ncurses", and I highly recommend it :-)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 18
    Last Post: 10-01-2015, 01:54 PM
  2. Replies: 1
    Last Post: 10-09-2014, 10:18 AM
  3. Portable, simple text-based graphics C library or stuff?
    By Mark Miller in forum C Programming
    Replies: 23
    Last Post: 09-24-2013, 05:34 AM
  4. Replies: 0
    Last Post: 03-26-2009, 02:47 PM
  5. sorting a doubly linked (linux-style) list
    By smoking81 in forum C Programming
    Replies: 4
    Last Post: 10-01-2008, 01:02 AM

Tags for this Thread