(C++) Scrolling Credits Code

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
AndyCR
Posts: 110
Joined: Tue Nov 08, 2005 2:51 pm
Location: Colorado, USA
Contact:

(C++) Scrolling Credits Code

Post by AndyCR »

Easy scrolling credits, just stick this in your main loop and replace ITEXTUREHERE with your itexture pointer, and replace driver and device etc if you use custom-named variables:

Code: Select all

u32 time = device->getTimer()->getTime();
driver->draw2DImage(ITEXTUREHERE, position2d<s32>((driver->getScreenSize().Width - ITEXTUREHERE->getOriginalSize().Width)/2, ((time/20)%(driver->getScreenSize().Height+ITEXTUREHERE->getOriginalSize().Height))-ITEXTUREHERE->getOriginalSize().Height));
To speed it up or slow it down, decrease (faster) or increase (slower) this part:

Code: Select all

time/20
Enjoy! :D
wowdevver24
Posts: 26
Joined: Mon Jan 04, 2010 8:02 pm

Post by wowdevver24 »

btw, you can actually do this more smoothly by changing u32 to f32 for time, position & 20 becomes 20.0f or a variable so you can alter speed of the credits using + and -
Remember all information is contextual and if I do not understand the context I cannot gras the information
Post Reply