Fade-to-black transitions May 15, 2010 08:59PM | Registered: 14 years ago Posts: 34 |
Re: Fade-to-black transitions May 16, 2010 12:23AM | Registered: 16 years ago Posts: 175 |
/** * Fade in, than fade out. * @param tex Texture. * @param scaleX Texture X scale. * @param scaleY Texture Y scale. * @param speed Fade speed (1 is the normal speed, 2 is two time the normal speed, etc). */ void GRRLIB_DrawImg_FadeInOut(struct GRRLIB_texImg *tex, float scaleX, f32 scaleY, u16 speed) { GRRLIB_DrawImg_FadeIn(tex, scaleX, scaleY, speed); GRRLIB_DrawImg_FadeOut(tex, scaleX, scaleY, speed); } /** * Fade in. * @param tex Texture. * @param scaleX Texture X scale. * @param scaleY Texture Y scale. * @param speed Fade speed (1 is the normal speed, 2 is two time the normal speed, etc). */ void GRRLIB_DrawImg_FadeIn(struct GRRLIB_texImg *tex, float scaleX, f32 scaleY, u16 speed) { s16 alpha; f32 xpos = (rmode->fbWidth - tex->w) / 2; f32 ypos = (rmode->efbHeight - tex->h) / 2; for(alpha = 0; alpha < 255; alpha += speed) { if(alpha > 255) alpha = 255; GRRLIB_DrawImg(xpos, ypos, tex, 0, scaleX, scaleY, 0xFFFFFF00 | alpha); GRRLIB_Render(); } } /** * Fade out. * @param tex Texture. * @param scaleX Texture X scale. * @param scaleY Texture Y scale. * @param speed Fade speed (1 is the normal speed, 2 is two time the normal speed, etc). */ void GRRLIB_DrawImg_FadeOut(struct GRRLIB_texImg *tex, float scaleX, f32 scaleY, u16 speed) { s16 alpha; f32 xpos = (rmode->fbWidth - tex->w) / 2; f32 ypos = (rmode->efbHeight - tex->h) / 2; for(alpha = 255; alpha > 0; alpha -= speed) { if(alpha < 0) alpha = 0; GRRLIB_DrawImg(xpos, ypos, tex, 0, scaleX, scaleY, 0xFFFFFF00 | alpha); GRRLIB_Render(); } }
Re: Fade-to-black transitions May 16, 2010 03:17PM | Registered: 14 years ago Posts: 121 |
Re: Fade-to-black transitions May 16, 2010 07:05PM | Registered: 14 years ago Posts: 34 |
Re: Fade-to-black transitions May 18, 2010 05:44PM | Registered: 14 years ago Posts: 121 |
Re: Fade-to-black transitions May 19, 2010 02:31AM | Registered: 16 years ago Posts: 30 |
Quote
LordAshes
If the information has helped you solve your problem, as a courtesy, you should edit the original post (i.e. the first post in this thread) and change the subject like to include something like *SOLVED*. This not only indicated to others that they do not need to reply but it also allows other, with the same problem, to see that a working solution has been posted.
Re: Fade-to-black transitions May 19, 2010 06:15PM | Registered: 14 years ago Posts: 121 |
Quote
ksmiller
(This is just a general question on this forum as I am noticing some topics saying *SOLVED*. Some forums don't like this and have it has a rule not to add them to titles so was checking for a general stance on this one.)