Skip to main content
gamedev.net
🔒 Locked

Backgrounds?

Started by RuneLancer Oct 25, 2002 at 6:20 PM 1 replies 200+ views
Original Post
RuneLancer
RuneLancer
I feel kinda newbie-ish posting some question like this one but oh well I''m using DirectDraw to render graphics in a 2D environment. Good ''ol sprites. I''m aiming for a game with an SNES-like feel to it. The problem''s with animating over a background. It''s pretty easy to simply clear the backbuffer every frame. Especially if there aren''t too many sprites or if the game is simplistic. But if a background is present, copying it back in the backbuffer every frame is terribly slow and does a number on the performance. So my question is, is there some day to make the background static? The only solution I see would be clearing the sprites and the likes by recopying the space occupied by them every time they move, which sounds kinda messy...
Kylotan
Kylotan
You might want to look up ''dirty rectangles'', which is basically the last idea you mention, but usually it''s not worth the effort on modern hardware. Especially if you have any kind of scrolling going on. There''s not really any way to get an ''automatic'' background there, since you are overwriting the memory each time you render to the buffer.

You could also look into DirectDraw''s overlay capability, but I don''t know how widely supported it is or how useful it would be, given that all overlays are displayed over the top of the primary surface.

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost | Asking Questions | Organising code files | My stuff ]
RuneLancer
RuneLancer
quote:
Original post by Kylotan
You might want to look up ''dirty rectangles'', which is basically the last idea you mention, but usually it''s not worth the effort on modern hardware. Especially if you have any kind of scrolling going on. There''s not really any way to get an ''automatic'' background there, since you are overwriting the memory each time you render to the buffer.

You could also look into DirectDraw''s overlay capability, but I don''t know how widely supported it is or how useful it would be, given that all overlays are displayed over the top of the primary surface.


Hrm, I was kinda sure I wouldn''t be able to do the first thing. Something like an overlay, but for the background, was what I had in mind. Ah well, programming isn''t meant to be done lazily anyways.

Dirty rectangles, hm? I heard about those once, but I never looked into the subject. Wether it''s worth the effort or not, it might give me some insight and some ideas on how to do this though. So thanks, every little bit helps I suppose ^^

Topic Locked

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

Sign in to reply to this topic.