You are not logged in.

#1 2008-12-31 12:34:37

GizmoTheGreen
Member

GRRLIB_Intro()

I thought it would be nice with a small intro movie function to show that you use GRRLIB.
The code is quick and dirty but its somewhat what i envisioned, lol

feel free to improve further!

Code:

#include <unistd.h>
#include "../gfx/logo.h"
#include "../gfx/gx_inside.h"
#include "../gfx/perso.h"

Code:

void GRRLIB_Intro()
{
    u8 *tex_person = GRRLIB_LoadTexture(perso);
    u8 *tex_inside = GRRLIB_LoadTexture(gx_inside);
    u8 *tex_logo = GRRLIB_LoadTexture(logo);
    
    int fade, x, y = 0;
    int anim = 8;
    
    for(fade = 0; fade<=254;fade++)
    {
        GRRLIB_DrawImg(640/2-(352/2), 480/2-(64), 352, 128, tex_logo, 0, 1, 1, fade);
        GRRLIB_DrawImg(640/2-(352/2+64), 480/2-(128), 64, 56, tex_inside, 0, 1.5, 1.5, fade);
        GRRLIB_Render();
        sleep(0.2);
    }
    
    x = 650;
    y = 310;
    
    while(1)
    {
        GRRLIB_DrawImg(640/2-(352/2), 480/2-(64), 352, 128, tex_logo, 0, 1, 1, 255);
        GRRLIB_DrawImg(640/2-(352/2+64), 480/2-(128), 64, 56, tex_inside, 0, 1.5, 1.5, 255);
        if(x>320)
        {
            GRRLIB_DrawTile(x, y, 32, 32, tex_person, 0, 1, 1, 255, anim, 24);
            if((anim++)>13) anim=8;
            x -= 1;
            usleep(950);
        }
        
        
        
        if(x==320)
        {
            GRRLIB_DrawImg(640/2-(352/2), 480/2-(64), 352, 128, tex_logo, 0, 1, 1, 255);
            GRRLIB_DrawImg(640/2-(352/2+64), 480/2-(128), 64, 56, tex_inside, 0, 1.5, 1.5, 255);
            GRRLIB_DrawTile(x, y, 32, 32, tex_person, 0, 1, 1, 255, 23, 24);
            GRRLIB_Render();
            sleep(1);
            GRRLIB_DrawImg(640/2-(352/2), 480/2-(64), 352, 128, tex_logo, 0, 1, 1, 255);
            GRRLIB_DrawImg(640/2-(352/2+64), 480/2-(128), 64, 56, tex_inside, 0, 1.5, 1.5, 255);
            GRRLIB_DrawTile(x, y-3, 32, 32, tex_person, 0, 1, 1, 255, 23, 24);
            GRRLIB_Render();
            sleep(1);
            GRRLIB_DrawImg(640/2-(352/2), 480/2-(64), 352, 128, tex_logo, 0, 1, 1, 255);
            GRRLIB_DrawImg(640/2-(352/2+64), 480/2-(128), 64, 56, tex_inside, 0, 1.5, 1.5, 255);
            GRRLIB_DrawTile(x, y-6, 32, 32, tex_person, 0, 1, 1, 255, 23, 24);
            GRRLIB_Render();
            sleep(1);
            GRRLIB_DrawImg(640/2-(352/2), 480/2-(64), 352, 128, tex_logo, 0, 1, 1, 255);
            GRRLIB_DrawImg(640/2-(352/2+64), 480/2-(128), 64, 56, tex_inside, 0, 1.5, 1.5, 255);
            GRRLIB_DrawTile(x, y-3, 32, 32, tex_person, 0, 1, 1, 255, 23, 24);
            GRRLIB_Render();
            sleep(1);
            GRRLIB_DrawImg(640/2-(352/2), 480/2-(64), 352, 128, tex_logo, 0, 1, 1, 255);
            GRRLIB_DrawImg(640/2-(352/2+64), 480/2-(128), 64, 56, tex_inside, 0, 1.5, 1.5, 255);
            GRRLIB_DrawTile(x, y, 32, 32, tex_person, 0, 1, 1, 255, 23, 24);
            GRRLIB_Render();
            sleep(1);
            x=319;
        }
        
        if(x<320)
        {
            GRRLIB_DrawTile(x, y, 32, 32, tex_person, 0, 1, 1, 255, anim, 24);
            if((anim++)>13) anim=8;
            x -= 1;
            usleep(950);
        }
        
        if(x<0)break;
        GRRLIB_Render();
    }
    
    for(fade = 255; fade>1;fade--)
    {
        GRRLIB_DrawImg(640/2-(352/2), 480/2-(64), 352, 128, tex_logo, 0, 1, 1, fade);
        GRRLIB_DrawImg(640/2-(352/2+64), 480/2-(128), 64, 56, tex_inside, 0, 1.5, 1.5, fade);
        GRRLIB_Render();
        sleep(0.2);
    }
    
}

now call GRRLIB_Intro(); in the beginning of your code, :)
and the gx inside logo need repositioning... :/

Offline

 

Board footer

Powered by FluxBB