Screen buffer
I have been working on a version of Tic Tac Toe that uses vector graphics in Allegro and mouse support. I have everything working pretty well except one small problem. When the player clicks on the square it draws their piece (X or O) in the square. However the area under the mouse pointer is blank. This was not a problem at first because I was continually redrawing the screen. But now I am trying to get the program to run as lean as possible and experiment with some new things I have learned (like the heap) so I don't want to redraw just add new symbols. I am thinking that if I create another buffer and have the mouse pointer on that while the board is on the screen this should solve my problem. Am I right? Or should I draw the board and symbols to the buffer and the mouse to the screen? If so the are these the steps I should follow: 1.create a bitmap the size of the screen called buffer 2. draw my lines with (screen,x,y,etc...) 3. show_mouse(buffer) And is this what people mean when they talk about double buffering (the screen is really a buffer right?)? I am not with my computer and book right now otherwise I would just try it. I am trying to plot out the code I will try tomorrow ahead of time on paper. I know I ask a lot of questions so I hope it is not annoying Thanks
You should look into dirty rectangles. Ive never used Allegro, but they allow you to update just one part of the screen, so you can just update wherever the player makes a move.
Sure is a big 'ol world.
Are you making sure to call scare_mouse before drawing?
-----------------------------Play Stompy's Revenge! Now!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement