CTransition class

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
Iyad
Posts: 140
Joined: Sat Mar 07, 2009 1:18 am
Location: Montreal, Canada

CTransition class

Post by Iyad »

I was re-coding my full game and i found that file , that I made since a really long time, in a hidden folder: CTransition.h, It is working well and I wanted to share it to the community.

Really simple code, I use it to make image transition between different scenes, (ie: for loading screen, for Intro-screen, etc...).

Here are some screens and a demo:
REMOVED IMAGES

Demo: (about 2mb)
REMOVED UNTIL FIX
FIXED RELEASE : http://www.mediafire.com/?wuymwymmjjn

How to use :

Code: Select all

 
///CALLING A NEW TRANSITION

    CTransition* Transit = new CTransition(device);

    Transit->CutScene(device->getVideoDriver()->getTexture("INTRO1.jpg"),
                                            0,SColor(0,255,255,0)); ///YELLOW TRANSIT
    Transit->CutScene(device->getVideoDriver()->getTexture("INTRO2.jpg"),
                                            0,SColor(0,0,255,255)); ///CYAN TRANSIT
    delete Transit;

    ///END OF TRANSITION
This is extremely simple to use, you simply call CutScene(), it has 3 parameters:
1-The texture, or image of background.
2-The time of showing image.
3-The color of fading.

You could also use the specific functions as FadeIn(), FadeOut() or Attendre(), to manually compose different transitions. Im used to add a load function to my loading transitions.

Enjoy it and thanks for commenting.
Last edited by Iyad on Wed Jun 02, 2010 4:27 pm, edited 3 times in total.
#include <Iyad.h>
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

Neither the demo or recompilled source want to work. It seems that there're updating problems ( when I move the window with mouse it actually updates! :lol: ), but I can't check it out and fix it at the moment(got illness, problems with throat and lungs.. Laptop FTW! :D ).. Hope you can fix it yourself it would be really nice to have it in my project :D
Iyad
Posts: 140
Joined: Sat Mar 07, 2009 1:18 am
Location: Montreal, Canada

Post by Iyad »

Neither the demo or recompilled source want to work
How come? I work perfectly with me, can you give more details? What computer are u using and which Irrlicht version you using?
It seems that there're updating problems ( when I move the window with mouse it actually updates! )
You mean, it does not update. Actually, when im trying to move the window, it simply stop fading, and when i release it, it continues fading.

If its always stuck to the first loop, simply change FAC_ALPHA value to a lower value.

If it's not what you mean, then i really dont understand what is the problem.

thanks for commenting,
and btw, im sorry for your illness.
#include <Iyad.h>
Iyad
Posts: 140
Joined: Sat Mar 07, 2009 1:18 am
Location: Montreal, Canada

Post by Iyad »

OHH, I know what you mean loool,
Im gonna fix that.

(Its because your computer is to fast hehehe)

Code: Select all

 Current_Alpha += round32(TimeCalculator()*FAC_ALPHA);
this is equaling almost 0 because TimeFactor is very low, and by rounding it it gives so 0 so it looks like theres no updating...
#include <Iyad.h>
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

Well, maybe my computer is a little too fast, I dunno ( 3,6GHz P4 HT cpu on PC and dual core 3.2GHz on Laptop :D ), but the main reason it is it won't update automatically. It works with short-moves around the screen, it actually changes between transits also :D Even multiplying the time calculator won't help, dah :|
Iyad
Posts: 140
Joined: Sat Mar 07, 2009 1:18 am
Location: Montreal, Canada

Post by Iyad »

Ok i have fixed it.
Actually it was really bad coded, but the general base was there so I didnt change everything.
FIXES (2 JUNE 2010):
-1.Changed

Code: Select all

typedef unsigned short int E_SHORT;

to

Code: Select all

typedef signed short int E_SHORT;
Well, without this it was always restarting the transition, because when Current_ALPHA < 0, it gets to 65536 (unsigned int) and restarts everything.

-2.Added

Code: Select all

float A = NO_ALPHA;

and changed this :

Code: Select all

Current_Alpha= round32(TimeCalculator()*FAC_ALPHA);

to this :

Code: Select all

A += (TimeCalculator()*FAC_ALPHA);
        Current_Alpha = round32(A);
THATS IT!
Now i still need some testers for this... because i have 1 computer working for now and its a P3 256mb ram with integrated graphic card (WORST THING FOR PROGRAMMING LOL) that i didnt even buyed (someone gave me because it was to old, I just dont know why I even thinked about learning programming LOOL), so yes, Murloc992, your computer is very fast.

I re-chekd everything and it should work...

Waiting your comments and thanks for reporting those issues.
#include <Iyad.h>
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

ty it works for me (ATI Mobility Radeon 1270).
Tho the screenshots dont work
Image
Image
Murloc992
Posts: 272
Joined: Mon Apr 13, 2009 2:45 pm
Location: Utena,Lithuania

Post by Murloc992 »

Working perfect now. :) Really appreciate what you've done. :)

Do you need credits if I use it? Just wondering. :roll:
Iyad
Posts: 140
Joined: Sat Mar 07, 2009 1:18 am
Location: Montreal, Canada

Post by Iyad »

Thanks!

Well, your not obligated...But if you want ill appreciate it and if you are using it in a project, just PM me I would like to see how did you implement it.
#include <Iyad.h>
Post Reply