Thread: problem with sdl_flip()

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    106

    problem with sdl_flip()

    Okay so ive been through lazy foos tutorial.. now im attempting to make a pong game, but now SDL_flip is giving me a problem.. when I comment it out my code runs fine.. I get a return 3.


    Code:
    #include <string>
    #include "SDL\SDL.h"
    #include "system.h"
    #include "Image.h"
    
    #define BPP 32
    #define SCREEN_W 640
    #define SCREEN_H 320
    
    SDL_Surface* display = NULL;
    int main(int argc, char* args[])
    {
        System system(SCREEN_W, SCREEN_H, BPP, "Pong");
        system.init();
        Image image;
        SDL_Surface *message;
        message = image.loadBMPImage("");
        image.applySurface(0, 0, message, system.screen);
        SDL_Flip(display);
        SDL_Delay(2000);
        system.cleanUp();
    }

  2. #2
    Registered User
    Join Date
    Apr 2004
    Location
    Ohio
    Posts
    147
    This is probably better off on SDL's mailing list but I'll see if I can help.

    The problem here is you're not showing how you initialize SDL. What surface parameters are you setting when you set the display mode?

    If you're having a problem when SDL_flip() is being called and not when it's commented out, you probably didn't set your screen mode to include SDL_DOUBLEBUF.

    I assume you create the screen mode in your system class so check that first.

  3. #3
    Registered User \007's Avatar
    Join Date
    Dec 2010
    Posts
    179
    You didn't init SDL?

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    106
    possibly im not sure. I decided to move on from this and I did it in another project and everything works fine

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM