Archived

This topic is now archived and is closed to further replies.

drdarkon

Drawing a Sprite

Recommended Posts

Hey everyone, I have written my 2d game engine and have run into a minor problem. Whenever my surfaces (sprites) are drawn offscreen (even if it is just a portion of the graphic) the image doesn''t show up at all. Is this something that I can easily handle? Is there some clipper of something I need to set up? Is this the problem. I want to be able to draw only partial images, or allow images to go offscreen smoothly without being abrubtly cut off. Thanks in advance for the advice... Note, I am using DirectDraw (DX7) - Jesse - Say What? Studios

Share this post


Link to post
Share on other sites
You will def need to set up a clipper. If not badly mistaken, without a clipper ddraw will still make sure you dont write into memory but it does it by not drawing the sprite if it goes offscreen. If you set up a clipper then you will get what you are looking for.



I think heh.

Share this post


Link to post
Share on other sites
If u''r running in fullscreen mode u don''t really need to setup clippers, in window mode, clippers are necessary but i don''t it''s the problem.

Well, i had a similar problem when i built my first game engine, but the reason was because when initializing my sprite i set the width and height to 0 by default.

So i advice u to double check ur codes.

Share this post


Link to post
Share on other sites
You don''t really need a clipper. I had that same problem just a few days ago and what you need to do is adjust the corners of the rectangle which is a parameter into the BltFast function.
So if your sprite is going off the sides you need to make the ''width'' less and if it''s going off the left side you''ll also have to adjust the ''left''. Same thing goes for up/down (top/height).

Share this post


Link to post
Share on other sites