コード例 #1
0
ファイル: font.c プロジェクト: ArtemioUrbina/240pTestSuite
void DrawNumber(u16 x, u16 y, u16 spriteIndex, u16 tileIndex, u16 pal)
{
	oamSet(spriteIndex, x, y, 3, 0, 0, tileIndex, pal); 
	oamSetEx(spriteIndex, OBJ_SMALL, OBJ_SHOW);
	oamSetVisible(spriteIndex, OBJ_SHOW);
	
	oamSet(spriteIndex+32, x, y+32, 3, 0, 0, tileIndex+4, pal); 
	oamSetEx(spriteIndex+32, OBJ_SMALL, OBJ_SHOW);
	oamSetVisible(spriteIndex+32, OBJ_SHOW);	
}
コード例 #2
0
ファイル: font.c プロジェクト: ArtemioUrbina/240pTestSuite
void DrawCircle(u16 x, u16 y, u16 spriteIndex, u16 tileIndex, u16 pal)
{
	oamSet(spriteIndex, x, y, 2, 0, 0, tileIndex, pal); 
	oamSetEx(spriteIndex, OBJ_SMALL, OBJ_SHOW);
	oamSetVisible(spriteIndex, OBJ_SHOW);
	
	oamSet(spriteIndex+32, x, y+32, 2, 0, 1, tileIndex, pal); 
	oamSetEx(spriteIndex+32, OBJ_SMALL, OBJ_SHOW);
	oamSetVisible(spriteIndex+32, OBJ_SHOW);	
	
	oamSet(spriteIndex+64, x+32, y, 2, 1, 0, tileIndex, pal); 
	oamSetEx(spriteIndex+64, OBJ_SMALL, OBJ_SHOW);
	oamSetVisible(spriteIndex+64, OBJ_SHOW);	
	
	oamSet(spriteIndex+96, x+32, y+32, 2, 1, 1, tileIndex, pal); 
	oamSetEx(spriteIndex+96, OBJ_SMALL, OBJ_SHOW);
	oamSetVisible(spriteIndex+96, OBJ_SHOW);	
}
コード例 #3
0
ファイル: DynamicSprite.c プロジェクト: beletsky/pvsneslib
//---------------------------------------------------------------------------------
int main(void) {
    // Initialize SNES 
	consoleInit();
	
	// Put current handler to our function
	spr_queue = 0xff; spr_mutex = 0;
	__nmi_handler=myconsoleVblank; 

	// Init Sprites gfx and palette with default size of 16x16 (and don't load sprite tiles)
	oamInitGfxSet(&gfxpsrite, 2, &palsprite, 16*2, 0, ADRGFXSPR, OBJ_SIZE16);

	// Define sprites parmaters
	oamSet(0,  100, 100, 3, 0, 0, 0, 0); // Put sprite in 100,100, with maximum priority 3 from tile entry 0, palette 0
	oamSetEx(0, OBJ_SMALL, OBJ_SHOW);
	
	// Now Put in 16 color mode and disable all backgrounds
	setMode(BG_MODE1,0); bgSetDisable(0); bgSetDisable(1); bgSetDisable(2);

	// add new sprite to queue
	addSprite(&gfxpsrite, ADRGFXSPR);
	
	// Wait for nothing :P
	while(1) {
			// Refresh pad values in VBL and Get current #0 pad
		pad0 = padsCurrent(0);
		
		if (pad0) {
			// Key A pressed
			if(pad0 & KEY_A) {
				// if not yet pressed
				if (padkeya == 0) {
					padkeya=1;  // avoid adding new sprite continuisly
					// add new sprite to queue
					addSprite((&gfxpsrite)+8*4*2, ADRGFXSPR);
				}
				
			}
			else
				padkeya=0;
		}
		
		// Wait VBL 'and update sprites too ;-) )
		WaitForVBlank();
	}
	return 0;
}
コード例 #4
0
ファイル: sprites.c プロジェクト: GEMISIS/Death-Match
static void loadSpriteData(Sprite_s* spr)
{//((spr->gfxId<<1)+((spr->gfxId<<7)&0x400))
	oamSet((spr->gfxId<<2), spr->x, spr->y, spr->priority, spr->vFlip, spr->hFlip, SPRITE1_ADDR_OFFSET + (testFrames[spr->gfxId&0xF]), spr->palId);//last parameter here is spr->palId. old spr->gfxId<<7
	oamSetEx((spr->gfxId<<2), spr->size, spr->visible);
	oamSetXYEx((spr->gfxId), spr->x, spr->y);
}