Return to Snippet

Revision: 59471
at September 10, 2012 05:05 by OdnetninI


Initial Code
int Ancho[128];
int Alto[128];

bool screen;

#define UP true
#define DOWN false

#define ERROR   {consoleDemoInit();iprintf("ERROR");while(1){swiWaitForVBlank();}}

void ODI_CreateDualSprite (uint8_t id , uint8_t gfx, uint8_t pal, uint8_t ancho, uint8_t alto) /*Será el mismo arriba que abajo*/
{
    NF_CreateSprite(0, id, gfx, pal, 0, 0);
    NF_CreateSprite(1, id, gfx, pal, 0-ancho, 0-alto);
    Ancho[id] = ancho;
    Alto[id] = alto;
}

void ODI_MoveDualSprite (uint8_t id, int x, int y ) 
{
    if (x < 0-Ancho[id])ERROR;
    if (x > 256)ERROR;
    if (y < 0-Alto[id])ERROR;
    if (y > 384)ERROR;
    
    if (y <= 191)screen = UP;
    else if (y >= 192)screen = DOWN;
    
    if (screen == UP)
    {
        NF_MoveSprite(0,id,x,y-192);
        NF_MoveSprite(1,id,0-Ancho[id],0-Alto[id]);
    }
    else if (screen == DOWN)
    {
        NF_MoveSprite(1,id,x,y-192);
        NF_MoveSprite(0,id,0-Ancho[id],0-Alto[id]);
    }
}

void ODI_DualSpriteLayer (uint8_t id, uint8_t layer)
{
    NF_SpriteLayer( 0,id,layer);
    NF_SpriteLayer( 1,id,layer);
}

void ODI_ShowDualSprite (uint8_t id, bool show )
{
    NF_ShowSprite(0,id,show);
    NF_ShowSprite(1,id,show);
}

void ODI_DualSpriteHflip (uint8_t id, bool hflip)
{
     NF_HflipSprite(0,id,hflip);
     NF_HflipSprite(1,id,hflip);
}

void ODI_DualSpriteVflip (uint8_t id, bool vflip)
{
     NF_VflipSprite(0,id,vflip);
     NF_VflipSprite(1,id,vflip);
}

void ODI_DualSpriteFrame (uint8_t id, uint8_t frame )
{
    NF_SpriteFrame(0,id,frame);
    NF_SpriteFrame(1,id,frame);
}

Initial URL

                                

Initial Description
Beta 1 of my fuctions.

Initial Title
Beta 0.1 DUAL SPRITES for NFLIB

Initial Tags

                                

Initial Language
C