How do I use graphics libaries in Linux C/C++?

This is a discussion on How do I use graphics libaries in Linux C/C++? within the Game Programming forums, part of the General Programming Boards category; I'm currently learning C in a Linux OS but I've already learned a lot of C++ in MSV 6.0. The ...

  1. #1
    Registered User Kuplex's Avatar
    Join Date
    Dec 2001
    Posts
    18

    Question How do I use graphics libaries in Linux C/C++?

    I'm currently learning C in a Linux OS but I've already learned a lot of C++ in MSV 6.0. The question is though, how do I use graphics and their libraries in Linux C and MSV C++ and how do I translate the C++ command: flush, in Linux C. Can anybody help me along with some info. I need it to start on my case study.
    Kuplex
    "The only thing you can count on is uncertainty."

    Must I explain myself futher?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    Well, if you use the Allegro library (graphics/sound/input), you don't have to change a single line of code to compile for MSVC in Windows and GCC in Linux. flush() is a standard C function and is thus also available in both platforms. Have you had trouble getting it to work?
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

  3. #3
    Registered User Kuplex's Avatar
    Join Date
    Dec 2001
    Posts
    18

    Talking thankx

    the tips that you gave me worked really well. but the flush i was referring to is in C++ it would be somnething like:

    //move to a section on the screen using x,y
    //set bg to a color
    cout << " " << flush;

    From previous experience, the << flush kept the color from over flowing from the space instead of covering the whole line:

    // color below w/ flush and 5 spaces

    *****_

    // without flush and 5 spaces
    ***********************
    _

    it covers the whole line of a screen instead of stopping
    Kuplex
    "The only thing you can count on is uncertainty."

    Must I explain myself futher?

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    375
    So.. your trying to find a C equiv? ('Cause Linux doesn't have any problems with C++..) Well, you won't be using cout at all then either I suppose, so it depends. For text stuff, use printf() (and its variants) and don't worry about flush because printf() is low level enough not to need it.

    Hope that helps.

    -Justin

    EDIT: Also see the curses library which allows for all sorts of fancy text stuff.
    Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linux Version reccomendation
    By Pobega in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 10-05-2006, 07:48 PM
  2. Linux Linux why Linux??
    By afreedboy in forum Tech Board
    Replies: 146
    Last Post: 01-21-2004, 06:27 PM
  3. Replies: 3
    Last Post: 10-29-2003, 09:39 AM
  4. Graphics in Linux
    By Xterria in forum Game Programming
    Replies: 3
    Last Post: 08-12-2002, 04:43 PM
  5. Linux? Windows Xp?
    By VooDoo in forum Linux Programming
    Replies: 15
    Last Post: 07-31-2002, 09:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21