dantay9 Posted April 24, 2010 Share Posted April 24, 2010 I am remaking my Yahtzee game because the old one was unreliable. Because I need reliability, I decided to draw the controls onto the window instead of actually having controls. I was going to use GDI+, but then AdmiralAlkex brought up the idea of using SDL instead of GDI+. This seems to have simplified a lot of the code as well as make it move along a little faster.My only problem is the RefreshGUI() method. When called, it paints the background over top of all other controls effectively allowing me to redraw the controls again. This is used when a score changes because I can't draw a new score over top of the previous score (which would be 0). So I have to redraw everything. The result of redrawing the whole screen is the flicker that is produced while drawing.I was wondering if there was a way to "double buffer" SDL like you can with GDI+. Or maybe there is another way?Here is the download for the files in the correct directory structure (very important). Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted April 29, 2010 Share Posted April 29, 2010 (edited) I almost didn't see you there on the seventh page (topics per page @ 30) So yeah, there is the $_SDL_DOUBLEBUF but I think that only works in HW and Fullscreen mode, so it's not very useful here I imagine. BUT the flickering could be reduced greatly by simply updating the screen less. Remember that _SDL_Flip($pSurface) moves the whole surface to the screen, and it should only be done when you want to see something new, not like you do here where you update every time you copied something to $pSurface. A quick hack that seems to remove the (noticeable) flickering with the scores is to remove UpdateGUI() from DrawImage() and add UpdateGUI() to the bottom of RefreshGUI(). Edited April 29, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
dantay9 Posted May 3, 2010 Author Share Posted May 3, 2010 That definately did it. Thanks for the help. I really like using SDL. I think it is much easier than using GDI+, especially when you want to draw stuff on top of a background. That normally takes a while in GDI+. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now