示例#1
0
文件: main.c 项目: troy56/palibds
// Function: main()
int main(int argc, char ** argv)
{
	PA_Init();    // Initializes PA_Lib
	PA_InitVBL(); // Initializes a standard VBL
	
	PA_Init3D(); // Uses Bg0, Init 3D...
	PA_Reset3DSprites(); // Init or Reset 3D Sprites
	
	
	// Initialise the text system on the top screen
	PA_InitText(1, 1);  // Initialise the text system on the top screen	
						
	PA_OutputSimpleText(1, 0, 8, "Move 3DSprite to change priority");	
	
	// First, create the gfx with the corresponding images and sizes. Images converted as 256colors textures in PAGfx
	gfx[0] = PA_3DCreateTex((void*)mollusk_Texture,  // Texture
									64, 64,						// Width, Height
									TEX_256COL );				// Texture Format

	
	// Load the Palettes !
	PA_Load3DSpritePal(0, // Slot
							(void*)mollusk_Pal); // Palette

	// Create a few sprites
	PA_3DCreateSpriteFromTex(0, gfx[0], 	64, 64, 	0, 	128, 96);

	u8 i;
	for(i = 0; i < 24; i++){
	   PA_3DCreateSpriteFromTex(i+1, gfx[0], 	64, 64, 	0, 	32, i*8);
	   PA_3DSetSpritePrio(i+1, 1024 + i*8); // Priority... (default is 1024)
	}   

	while(1) {
		if(Stylus.Held) {
		   PA_3DSetSpriteXY(0, Stylus.X, Stylus.Y);
		   PA_3DSetSpritePrio(0, 1024 + Stylus.Y); // Priority depending on Y position...
		}   

		PA_WaitForVBL();
		PA_3DProcess();  // Update sprites
	}


	
	return 0;
} // End of main()
示例#2
0
文件: main.c 项目: troy56/palibds
// Main function
int main(void)	{
	// PAlib init
	PA_Init();
	PA_InitVBL();
	
	PA_Init3D();
	PA_Reset3DSprites();
	
	PA_InitText(1, 0);

	PA_Load3DSpritePal(0, (void*)som_Pal);	// Palette....	

	s32 x = 128; s32 y = 96;

	PA_3DCreateSprite(0,(void*)som_Texture, 32, 32, TEX_256COL, 0, x, y); // Sprite
	
	while(1)
	{
		// Animation code...
		if(Pad.Newpress.Up) PA_3DStartSpriteAnim(0, 0, 3, 6);
		if(Pad.Newpress.Down) PA_3DStartSpriteAnim(0, 8, 11, 6);		
		
		if(Pad.Newpress.Right) {
			PA_3DStartSpriteAnim(0, 4, 7, 6);	
			PA_3DSetSpriteHflip(0, 0);
		}
		if(Pad.Newpress.Left) {
			PA_3DStartSpriteAnim(0, 4, 7, 6);	
			PA_3DSetSpriteHflip(0, 1);
		}

		
		if(!((Pad.Held.Left)||(Pad.Held.Up)||(Pad.Held.Down)||(Pad.Held.Right))) PA_3DSpriteAnimPause(0, 1);
	
	
		// Moving Code
		y += Pad.Held.Down - Pad.Held.Up;
		x += Pad.Held.Right - Pad.Held.Left;		
		PA_3DSetSpriteXY(0, x, y);
	
		PA_WaitForVBL();
		PA_3DProcess(); // Update 3D...
	}
	
	return 0;
}
示例#3
0
void Stone::draw(int x, int y, char c)
{
	u16 sgfx;
	PA_Load3DSpritePal(1, (void*)stone_Pal); // Palette	
	 
  switch (c) {
  case BLACK:
    sgfx = PA_3DCreateTex((void*)blackstone_Texture, 16, 16, TEX_256COL);
    PA_3DCreateSpriteFromTex(x+18*y, sgfx, 16, 16,  1, x*10+71, y*10+7);
    PA_PlaySimpleSound(sound_stone);	
    break;
  case WHITE:
    sgfx = PA_3DCreateTex((void*)whitestone_Texture, 16, 16, TEX_256COL);
    PA_3DCreateSpriteFromTex(x+18*y, sgfx, 16, 16,  1, x*10+71, y*10+7); 
    PA_PlaySimpleSound(sound_stone);	
    break;
  case FRONTIER:
  
   case EMPTY:
    PA_3DDeleteSprite(x+18*y);
    break;
  default:
    break;
  }	
	
			
	
	
//	 PA_3DSetSpriteWidth(x+18*y,8);
//	PA_3DSetSpriteHeight(x+18*y,8);
	PA_3DSetSpriteFrame(x+18*y, 0);
	   
	//PA_3DSetSpriteAlpha(x+18*y, 15);
	//PA_3DSetSpritePolyID(x+18*y, 0);
	PA_3DProcess();  // Update sprites
	PA_WaitForVBL();
}
示例#4
0
文件: main.c 项目: troy56/palibds
// Main function
int main(void)	{
	// PAlib init
	PA_Init();
	PA_InitVBL();
	
	PA_Init3D(); // Uses Bg0, Init 3D...
	PA_Reset3DSprites(); // Init or Reset 3D Sprites
	
		
	
	PA_InitText(1, 0);
	
	PA_OutputText(1, 0, 10, "Press Pad to change frame");
	
	// Load the sprite palette, 
	PA_Load3DSpritePal(0, // Palette number
					(void*)frames_Pal);	// Palette name
	
	gfx[0] = PA_3DCreateTex((void*)frames_Texture, 32, 32, TEX_256COL);
	
	PA_3DCreateSpriteFromTex(0, gfx[0], 	32, 32, 	0, 	128, 96);
	
	
	while(1)
	{
		if (Pad.Held.Up) PA_3DSetSpriteFrame(0, 0); // screen, sprite, frame
		if (Pad.Held.Down) PA_3DSetSpriteFrame(0, 2); // screen, sprite, frame
		if (Pad.Held.Left) PA_3DSetSpriteFrame(0, 3); // screen, sprite, frame
		if (Pad.Held.Right) PA_3DSetSpriteFrame(0, 1); // screen, sprite, frame		
	
		PA_WaitForVBL();
		PA_3DProcess();
	}
	
	return 0;
}
示例#5
0
void Board::set_mode(int m)
{
	u16 gfx[6];
	PA_Load3DSpritePal(2, (void*)buttons_Pal); // Palette	
  mode |= m;
  if (mode&BOARD_OBSERVE) {
   // UI->load->hide();
  //  UI->edit->show();
  //  UI->scoring->hide();
  } else {
  //  UI->load->show();
  //  UI->edit->hide();
   // UI->scoring->show();
    gfx[PASSBUTTON] = PA_3DCreateTex((void*)pass_Texture, 64, 32, TEX_256COL);
    PA_3DCreateSpriteFromTex(PASSBUTTON, gfx[PASSBUTTON], 64, 32,  2, 32, 164);
    	PA_3DProcess();  // Update sprites
	PA_WaitForVBL();
  }

  if (mode&BOARD_PLAYING) {
   // UI->komi->show();
   // UI->handicap->show();
   // UI->pass->show();
    gfx[PASSBUTTON] = PA_3DCreateTex((void*)pass_Texture, 64, 32, TEX_256COL);
    PA_3DCreateSpriteFromTex(PASSBUTTON, gfx[PASSBUTTON], 64, 32,  2, 32, 164);
    	PA_3DProcess();  // Update sprites
	PA_WaitForVBL();
   
   // UI->adjourn->show();
  //  UI->undo->show();
  //  UI->close->hide();
  //  UI->resign->show();
    if (mode&BOARD_SCORING) {
    //  UI->resign->label("Done");
      update_territory();
    } else {
    //  UI->resign->label("Resign");
  //  UI->resign->redraw();
}
  } else {
   // UI->komi->hide();
   // UI->handicap->hide();
   // UI->pass->hide();
  //  UI->adjourn->hide();
  //  UI->undo->hide();
  //  UI->close->show();
  //  UI->resign->hide();
  }

#ifdef CKM_STORED
  if (mode&BOARD_LOOKING) {
   // UI->scoring->hide();
   // UI->edit->hide();
   // UI->load->hide();
   // UI->save->hide();
  }
#endif

  if (mode&BOARD_SCORING) {
  //  UI->status->value(mode&BOARD_PLAYING? 
	   //    "Mark dead stones then click Done." :
	   //    "Mark dead stones with left click, drop frontiers with right click.");
  } else if (!(mode&BOARD_PLAYING)) {
   // UI->status->value("Edit mode.");
  }
}