SDL question...

This is a discussion on SDL question... within the Game Programming forums, part of the General Programming Boards category; I have just started to learn SDL.. I read a tutorial about displaying bitmaps and it told me to use ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    80

    SDL question...

    I have just started to learn SDL.. I read a tutorial about displaying
    bitmaps and it told me to use the function SDL_Flip(SDL_Surface *screen)
    Now I wonder why this is preferred since the bitmap is displayed
    properly without it.


    One more question, which is the preferred way of coloring single pixels?
    Is it by calling SDL_FillRect() or by writing a new function for the task?
    I've seen alot of tutorials on writing a pixel coloring function...


    I will really appreciate it if anyone could take som time to answer
    these questions.

  2. #2
    Registered User MathFan's Avatar
    Join Date
    Apr 2002
    Posts
    190
    to use the function SDL_Flip(SDL_Surface *screen)
    Now I wonder why this is preferred since the bitmap is displayed properly without it.
    The SDL_Flip() function flips between the two screen surfaces when you are using double buffer mode (if I remember it correctly). It can be used for animation. Flipping between surfaces makes the change between animation frames seemless and therefore the animation itself more fluent. It is also used when objects on the screen are moving, so that the movement seems, again, more fluent and not choppy.


    Is it by calling SDL_FillRect() or by writing a new function for the task?
    Well, that depends on what your program is going to do. If you are going to draw MANY pixels, make a function. If your program is drawing only a few pictures, you can use the good ol' SDL_FillRect() without it making your program run slower.
    The OS requirements were Windows Vista Ultimate or better, so we used Linux.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    80
    I see, thank you very much!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. another do while question
    By kbpsu in forum C++ Programming
    Replies: 3
    Last Post: 03-23-2009, 01:14 PM
  2. SDL questions
    By Cpro in forum C++ Programming
    Replies: 1
    Last Post: 08-09-2008, 01:26 PM
  3. SDL - IMG_Load() question
    By Stonehambey in forum Game Programming
    Replies: 1
    Last Post: 07-01-2008, 05:09 AM
  4. simple SDL question
    By sand_man in forum Game Programming
    Replies: 3
    Last Post: 07-02-2004, 01:04 AM
  5. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 10:47 PM

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