|
Using 2 buffers |
Money
Member #6,730
December 2005
|
hey, im creating a pong clone and for my menus im using guichan gui engine ok so i have a main menu, options button and start game button i have 2 pointers to container types Container *top; and Container *top2; and i have three 2 buffers... the screen bufer, and the bg buffer BITMAP *buffer; for guichan i have graphics pointing to the bg bitmap for drawing widgets so in the options menu, i have gui->setTop(top); then the while loop, insdie while loop is the code like the menu and buttons anyway at the end of the while loop i have gui->draw(); masked_blit(buffer2,bg,0,0,0,0,800,600); blit(bg,buffer,0,0,0,0,800,600); blit(buffer,screen,0,0,0,0,800,600); and i have a button in this options menu, called back to main, in which if its pressed i return a value for the choice engine, which returns back to main menu and for the start button code, when user presss start button i do everything accordingly so i gui->setTop(top2); before i go into while loop which is the code for some more choices at the end of this loop i have gui->draw(); masked_blit(buffer2,bg,0,0,0,0,800,600); blit(bg,buffer,0,0,0,0,800,600); blit(buffer,screen,0,0,0,0,800,600); now if i go to options menu then click back to main then click start game the widgets from options menu is still showing i tried putting clear_bitmap(buffer2) before gui->setTop(top2); but theres probs with that how am i suposed to handle doing diferent widgets for different menus i need to clear bg so the widgets wont show anymore, but it really doesn't work that well pls help...if you want me to post my code i can, just ask me but i kinda wanna do it myself, just wanted to know what the heck was wrong |
Kris Asick
Member #1,424
July 2001
|
Quote: i tried putting clear_bitmap(buffer2) before gui->setTop(top2); but theres probs with that In that case, you should go with that and solve those other problems instead. What's likely going on is that buffer2 is retaining everything you've drawn to it, so when you leave the options menu, everything that was drawn by it remains. .Any solution you come up with will require you to redraw certain things that would've been erased either by the elements drawn by the options menu, or erased calling clear_bitmap() on buffer2. --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
|