Jump to content
  • Advertisement
Sign in to follow this  
jimmySmile

cyclic screen for images, how to?

This topic is 3474 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hope this is the right forum for my problem... i'm working on a game in cpp (but can move to C# if needed). I need to implement in my game a system of a cyclic screen, where an image is "going out" of the screen in one direction (say right direction and 30% of the image is out) and it will appear from the other side of the screen (the 30% of the image from left in the case of the example). so ant ideas??

Share this post


Link to post
Share on other sites
Advertisement
If you're talking about screen fades and screen wipes then both can be quite easily implemented using screen sized textures.

Fading is usually implemented using alpha-blending, which some textures support, and of course textures can easily move around the screen.

I'm sure there are other ways to implement these effects, but at least this is an idea!

Share this post


Link to post
Share on other sites
I implemented a s imilar feature a week ago. All you need to do is draw each object 9 times in different positions. example:

[source lang='C++']

draw(pos.x, pos.y);

draw(pos.x + ScreenWidth, pos.y);
draw(pos.x - ScreenWidth, pos.y);

draw(pos.x, pos.y + ScreenHeight);
draw(pos.x, pos.y - ScreenHeight);

draw(pos.x + ScreenWidth, pos.y + ScreenHeight);
draw(pos.x - ScreenWidth, pos.y - ScreenHeight);

draw(pos.x + ScreenWidth, pos.y - ScreenHeight);
draw(pos.x - ScreenWidth, pos.y + ScreenHeight);




You might want to cull out any renderings of the object that are outside of the screen. Also, every time the object's position is outside of the screen, set it's position to pos % resolution.

Share this post


Link to post
Share on other sites
The easiest way is to draw your image twice - once at one end of the screen, with 70% of the image inside the screen, and then again at the other end of the screen with 30% inside. You calculate the second drawing position by adding/subtracting the screen's width/height from the first position's x/y value.

Ofcourse, it won't work if your drawing method crashes when you try to draw pixels out of the screen.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!