How to implement double buffering?
Hi,
I'm porting a game from MIDP to the BB API but the Screen classes' double buffering doesn't work like in GameCanvas. I can't do all the painting in the paint(g) method so I created an auxiliary buffer and in paint I draw the buffer, but I still get the flickerings: Code:
theBuffer = new Bitmap(screenWidth, screenHeight); |
Have you tried the midp version of this game on BB? If you haven't, then it may be just that hardware you're on, and not the lack of buffering. BB's cpu's are much slower than the competition's and it's much harder to get comparable frame rates.
Try avoiding full screen repaints if possible. Instead of buffering the whole screen, try buffering sections of the screen and paint only what's changed, etc. Profile your code. Quote:
|
The MIDP version is double buffered. After some research I found a way to do the double buffering: I make a secondary buffer, theBuffer, upon which I call the drawing method inside a "invokeAndWait()" and invalidate after this. In the paint method I paint only the buffer on the screen, like in the paint method posted on the first post.
Code:
UiApplication.getUiApplication().invokeAndWait( |
All times are GMT -5. The time now is 02:17 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.