Thread: SDL question...

  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, 12:14 PM
  2. SDL questions
    By Cpro in forum C++ Programming
    Replies: 1
    Last Post: 08-09-2008, 12:26 PM
  3. SDL - IMG_Load() question
    By Stonehambey in forum Game Programming
    Replies: 1
    Last Post: 07-01-2008, 04:09 AM
  4. simple SDL question
    By sand_man in forum Game Programming
    Replies: 3
    Last Post: 07-02-2004, 12:04 AM
  5. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM