Skip to main content
gamedev.net
🔒 Locked

game loop

Started by jagguy Feb 25, 2005 at 3:20 AM 1 replies 300+ views
Original Post
jagguy
jagguy
is it more of a standard to write a game loop and draw the whole screen each frame or just erase a write what sprites you need. say on a static background. or doesnt it really matter , if you still get a good frame rate? i prefered to simply erase and paint what sprites you need on a background in window mode but found it easier to simply paint the whole screen per frame in a fullscreen mode. using c++,directX
jagguy
jagguy
Quote:
Original post by Anonymous Poster
both are fine really, as you say, so long as you get a good frame rate.
It usually depends on how many sprites you have running around on screen and/or how big they are. There's an overhead in tracking the position, and blitting small background boxes, especially if you are also doing a grab behind cycle as well (only if you have no copy of the screen I would I have thought), so you have to erase them in the right order before drawing and so on.

You don't have to do any of that when your just blitting down the whole screen and drawing fresh sprites over it..usually to a back buffer.

Its up to you, if its just a few sprites and your machine is reasonable spec, erase the area around the sprites and redraw, repeat until done...otherewise blit the whole screen, redraw sprites and display...effect is the same.


i was hoping someone would say that.

what about for a moving background eg rpg 2d/3d (dont know much about 3d yet)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.