2D screen updates

Blitz3D Forums/Blitz3D Beginners Area/2D screen updates

slenkar(Posted 2004) [#1]
Do you have to clear the screen every frame in a 2D game?
Just wondering if I can have different parts of the screen update at different frequencies.


Kevin_(Posted 2004) [#2]
use the 'rect' command to clear certain area's only.


WolRon(Posted 2004) [#3]
Check out the Origin and Viewport commands.


TomToad(Posted 2004) [#4]
An old trick used would be to determine where the character would go, then do a CopyRect to copy that portion of the screen, then DrawRect the character onto the screen. When the character needs to be moved, you would just DrawRect the previously saved buffer to restore the screen, call CopyRect on the new position, then DrawRect the character, on and on as the character keeps moving from frame to frame. I haven't tried it in Blitz to see if it's any faster or not. Of course, it would be determined by the type of game. If you're doing a scrolling tile game, you'll probably need to redraw the entire screen again, in which case, a cls probably wouldn't be necessary at all.


slenkar(Posted 2004) [#5]
thanks, I just wondered if a map of the area would be slow and if it would be possible to speed it up,it seems viewport may work for that