예제 #1
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();
}
예제 #2
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()
예제 #3
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
	PA_Reset3DSprites();
	
	// Initialise the text system on the top screen
	PA_InitText(0, 1);
	PA_InitText(1, 1);  // Initialise the text system on the top screen	
						
	PA_OutputSimpleText(1, 0, 6, "Move the Sprite with the stylus");	
	
	// First, create the gfx with the corresponding images and sizes. Images converted as 16bit sprites in PAGfx
	gfx[0] = PA_3DCreateTex((void*)mollusk_Texture, 64, 64, TEX_16BITS);	
	
	// Create 4 sprites for the different flips......
	PA_3DCreateSpriteFromTex(0, gfx[0], 64, 64, 	0,		80, 48); // X, Y SPRITE CENTER !
	PA_3DCreateSpriteFromTex(1, gfx[0], 64, 64, 	0,		80+96, 48); // X, Y SPRITE CENTER !	
	PA_3DCreateSpriteFromTex(2, gfx[0], 64, 64, 	0,		80, 80+64); // X, Y SPRITE CENTER !
	PA_3DCreateSpriteFromTex(3, gfx[0], 64, 64, 	0,		80+96, 80+64); // X, Y SPRITE CENTER !
	
	// Set the flips
	PA_3DSetSpriteHflip(0, 0);		PA_3DSetSpriteVflip(0, 0);
	PA_3DSetSpriteHflip(1, 1);		PA_3DSetSpriteVflip(1, 0);	
	PA_3DSetSpriteHflip(2, 0);		PA_3DSetSpriteVflip(2, 1);
	PA_3DSetSpriteHflip(3, 1);		PA_3DSetSpriteVflip(3, 1);	
		
	while(1) {


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


	
	return 0;
} // End of main()
예제 #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
Board::Board(int m):root_story(-1, -1, 0)
{
#ifdef CKM_STORED
//  pIgs = NULL;
#endif

	
	
  size = 19;
 // UI = new FlBoard();
 // time_color = UI->black_time->text_background();
 //time_color2 = UI->black_time->text_color();
  //UI->b = this;
  set_size(size);
  cur_player = BLACK;
  for (int i=0; i<19; i++)
    for (int j=0; j<19; j++) {
      b[i][j] = EMPTY;
      root_story.b[i][j] = EMPTY;
    }
  s = &root_story;

  pos = 0;
  root_story.score[0] = score[0] = 0; 
  root_story.score[1] = score[1] = 0.5;
  mode = 0;
  set_mode(m);
//  owner = 0; //< pointer on the possibly associated IGS game
  memset(inib, EMPTY, 19*19);
  memset(dead, EMPTY, 19*19);
  memset(territory, EMPTY, 19*19);
    memset(b, EMPTY, 19*19);
 // memset(old_c, 0, sizeof(old_c)); //time color
  next = first;
  first = this;
  if (!stn) {
    stn = new Stone();
    stn->set_size(20);
  //  stn->init_image();
  }
 // UI->black_box->image(stn->img[0]);
 // UI->white_box->image(stn->img[1]);
 // UI->black_name->hide();
//  UI->white_name->hide();
//  UI->black_time->hide();
  //UI->white_time->hide();
 // UI->moves_browser->board = this;
 // UI->observer_browser->callback(observer_cb, this);
  //  UI->moves_browser->type(Fl_Browser::VERTICAL | Fl_Browser::MULTI_BROWSER);
  strcpy(blackname, "");
  strcpy(blackrank, "");
  strcpy(whitename, "");
  strcpy(whiterank, "");
  filename = 0;
  title = 0;
 
  
  PA_ResetBgSys();
  PA_ResetSpriteSys();
	PA_Init3D(); 
	PA_Reset3DSprites();
	
	PA_LoadTiledBg(0, 3, board19); 
	PA_LoadTiledBg(1, 1, bgscoreigs); 
	PA_Init16cBg(1, 0);
	PA_16cText(1, 120, 10, 255, 192, "chris28ttttt [17k]", 1, 2, 100);	
	//	PA_LoadSpritePal(0, 1, (void*)pass_Pal); 
		
	
 
 	
 	
		PA_3DProcess();  // Update sprites

		PA_WaitForVBL();
		
		if (!ptn) {
    ptn = new Pointer();
    
  }
  u16 gfx[6];
 gfx[PASSBUTTON] = PA_3DCreateTex((void*)pass_Texture, 64, 32, TEX_256COL);
    PA_3DCreateSpriteFromTex(PASSBUTTON, gfx[PASSBUTTON], 64, 32,  2, 33, 164);
    	PA_3DProcess();  // Update sprites
	PA_WaitForVBL();

      
//	while (COND_PLAY_MOVE) {
	while(!(mode&BOARD_OBSERVE)) {
		ptn->move();
		
		//add_move(ptn->xpointer, ptn->ypointer);
		
		 if (mode&BOARD_SCORING) {
  		  //  if (s->nbvariants) return 1;
    	  if (mode&BOARD_PLAYING) {
				if (!dead[ptn->xpointer][ptn->ypointer]) {
	 				char c = 'a'+ptn->xpointer;
	  				if (c>='i') c++;
	  				char s[10];
	 				// sprintf(s, "%c%d", c, this->size-my);
	 				//	 owner->igs->send(s);
				}
     	 }
     	 else {
			if (0)//(mk == 1) event button 
	 		 remove(ptn->xpointer,ptn->ypointer, cur_board->b[ptn->xpointer][ptn->ypointer], !dead[ptn->xpointer][ptn->ypointer]);
			else {
	 		 	if (b[ptn->xpointer][ptn->ypointer] == EMPTY)
	   		 	dead[ptn->xpointer][ptn->ypointer] = dead[ptn->xpointer][ptn->ypointer] == 2? 0:2;
			}
			//	cur_board->dead[mx][my] = !cur_board->dead[mx][my];
			//	refresh();
			//	redraw();
			update_territory();
     	 }
    	}
    
    else if (b[ptn->xpointer][ptn->ypointer] == EMPTY) {
      if (mode&BOARD_PLAYING) { //IGS
		char s[10];
		char c = 'a'+ptn->xpointer;
		if (c>='i') c++;
		//sprintf(s, "%c%d", c, this->size-my);
		//owner->igs->send(s);
      }
      else { // edit mode
      
		add_move(ptn->xpointer, ptn->ypointer);
	//	refresh();
		update_pos();
      }
    }
		// sprintf(debug,"player : %d",cur_player);
		// PA_16cText(1, 10, 30, 255, 192, debug, 1, 2, 100);	
	//	refresh();
	//	update_pos();
	}
		
 //	PA_CreateSprite(0, 1, (void*)pass_Sprite, OBJ_SIZE_64X32, 1, 1, 1, 60);  
}
예제 #6
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.");
  }
}