[SDL] "Eww" effect

This is a discussion on [SDL] "Eww" effect within the Game Programming forums, part of the General Programming Boards category; So I've decided to implement a message-based system to things in my engine - this includes rendering. Bascially the engine ...

  1. #1
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709

    [SDL] "Eww" effect

    So I've decided to implement a message-based system to things in my engine - this includes rendering. Bascially the engine will send a message to the player once every iteration of the game loop to tell him to redraw himself at a given X,Y co-ord.

    T'all works well except the sprite leaves nasty trails behind it when it moves. I tried to SDL_FillRect() the background every frame but that didn't work - it all just went blank.

    I haven't used SDL very much so is there something else I'm supposed to be doing?

    EDIT: Oh and if you're wondering, I've decided to clone that good ol' Net Yaroze version of Rocks 'n' Gems as my first game. And that sprite was 4 red dots until I moved it.

    EDIT2: I looked at SDL_UpdateRect(), made no difference.
    Attached Images Attached Images  
    Last edited by cboard_member; 04-27-2006 at 01:54 PM.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Are you sure your player is receiving only one Draw event each iteration?

  3. #3
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,803
    Are you using double buffering? Cause if so you draw to the second buffer, blit it to the screen, clear it and then re-draw it rinse and repeat.
    Woop?

  4. #4
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Cheers prog-bman. I just realised I had initialised SDL without SDL_DOUBLEBUF, so I just switched on double buffering and cleared after each SDL_Flip and it works.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  5. #5
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,803
    Your welcome, even though I do the allegro thingy I did dabble in SDL .
    Woop?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Type Writer Effect help please.
    By Fujitaka in forum C Programming
    Replies: 6
    Last Post: 02-01-2009, 09:11 AM
  2. [sdl] help with pong collision
    By caffeinated in forum Game Programming
    Replies: 8
    Last Post: 05-14-2008, 01:39 PM
  3. operator has no effect ??
    By studentc in forum C Programming
    Replies: 3
    Last Post: 05-28-2004, 07:28 AM
  4. effect of following code
    By cruzinny in forum C Programming
    Replies: 2
    Last Post: 10-22-2002, 04:44 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

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