Page 1 of 1

CTransition class

Posted: Mon May 31, 2010 7:17 pm
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.

Posted: Tue Jun 01, 2010 1:07 pm
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

Posted: Wed Jun 02, 2010 12:49 am
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.

Posted: Wed Jun 02, 2010 12:52 am
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...

Posted: Wed Jun 02, 2010 8:44 am
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 :|

Posted: Wed Jun 02, 2010 4:07 pm
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.

Posted: Wed Jun 02, 2010 4:26 pm
by B@z
ty it works for me (ATI Mobility Radeon 1270).
Tho the screenshots dont work

Posted: Wed Jun 02, 2010 4:28 pm
by Murloc992
Working perfect now. :) Really appreciate what you've done. :)

Do you need credits if I use it? Just wondering. :roll:

Posted: Wed Jun 02, 2010 4:41 pm
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.