void PlayerBrowser::draw(){
	
	s8 i = 0;
	
	PA_SetBrightness(0, -31); // all black
	PA_SetBrightness(1, -31); // all black	
  	
	PA_ResetSpriteSys();
	PA_Init16cBg(1, 0);
	PA_Init16cBg(0, 0);
	PA_LoadTiledBg(1, 1, bgplayer1);  
	PA_LoadTiledBg(0, 1, bgplayer0);  
	PA_LoadSpritePal(0, 1, (void*)pbutton_Pal); 
	PA_KeyboardOut();

	PA_CreateSprite(0, TERM_SCREEN, (void*)term_Sprite, OBJ_SIZE_64X32, 1, 1, 0, 0);  
	PA_CreateSprite(0, PLAYERS_SCREEN, (void*)players_Sprite, OBJ_SIZE_64X32, 1, 1, 64, 0);  
	PA_CreateSprite(0, GAMES_SCREEN, (void*)games_Sprite, OBJ_SIZE_64X32, 1, 1, 128, 0);  
	PA_CreateSprite(0, OPTIONS_SCREEN, (void*)options_Sprite, OBJ_SIZE_64X32, 1, 1, 192, 0);  

	PA_SetSpriteAnim(0, 11, 1);
	
	for(i = -31; i < 0 ; i++){
		PA_SetBrightness(0, i); 
		PA_SetBrightness(1, i); 
		PA_WaitForVBL();		   
	}  	
	PA_16cText(0, 6, 85, 80, 95, "NAMEXXXXXX", 1, 1, 100);
	PA_16cText(0, 88, 85, 127, 95, "[12k*]", 1, 1, 100);
	PA_16cText(0, 128, 85, 136, 95, "X", 1, 1, 100);
	
	PA_16cText(0, 6, 95, 80, 115, "NAMEXXXXXX", 1, 1, 100);
	PA_16cText(0, 88, 95, 127, 115, "[12k*]", 1, 1, 100);
	PA_16cText(0, 128, 95, 136, 115, "X", 1, 1, 100);	 
}
예제 #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_Init16cBg(0, 3); 	PA_Init16cBg(1, 3);  // 16 color background init with default colors for text
	


	
	// Infinite loop to keep the program running
	while (1)
	{
		sprintf(text,  // string to use
					"%02d/%02d/%02d", PA_RTC.Day, PA_RTC.Month, PA_RTC.Year);  // String to transform
		PA_16cText(0, 10, 20, 255, 40, text, 1, 3, 100);  // Display the text transformed :)

	// And the time...
		sprintf(text,  "%02d:%02d  %02d seconds", PA_RTC.Hour, PA_RTC.Minutes, PA_RTC.Seconds);
		PA_16cText(0, 10, 40, 255, 60, text, 1, 3, 100);	// Display the text transformed :)

		PA_WaitForVBL();
		PA_16cErase(0);
	}
	
	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_Init16cBg(0, 2);  //Initializes a 16 color bg
	PA_LoadPal16c(PAL_BG0, ropes_Pal); //And loads its palette
	PA_16cErase(0);	//Clear bg before start drawing

	u8 i=0;	// position of our rope, from bottom
	u8 j=0;  // step of our animation
	u8 frames=0; //frames rendered, usefull to do animation timing

	// Infinite loop to keep the program running
	while (1)
	{	
		i+=1; //Move the rope up 1 pixels
		if (i>192) i=0; //If the rope has hit the top of the screen, start again from bottom

		if (++frames==20) //If we have render 20 consecutive frames
		{
			j=j+64;			//Change animation to next frame
			// ropes_Sprite has three 8x16 pixels frames, so each frame is (8x16)/2 = 64 bytes (since each pixels is 4bits)
			// so our stride on the animation image is 64.
			if (j>128) j=0;//Check frame limit (only 3 frames on this animation)
			frames=0;		//Reset frame counter
		}

		PA_WaitForVBL(); //Typical wait for vertical blank...
		PA_16cErase(0);  //Erase background (if there is only one row like in this example, you should erase only the space ocupped by the row).
		PA_16c8Xi(0,125,192-i,(u32*)(ropes_Sprite+j),i); //Draw the row.
	}

	return 0;
} // End of main()
예제 #4
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);  
}
예제 #5
0
void CMenu::displayMenu(void) {
    u16 position_castle(36);
    s8 l_i;
    // Reset the background system
    PA_ResetBgSys();
    // Initialize the text at the top and bottom screens
    PA_InitText(1,0);
    PA_Init16cBg(1, 1);
    //PA_Init16cBg(1, 1);
    //PA_InitCustomText(1, 0, PA_Text);
    //PA_InitText(0,0);
    PA_Init16cBg(0, 1);
    // Load the grass background at the top screen
    PA_EasyBgLoad(1, 2, grass);
    // Set the screens' brightness to white
    PA_SetBrightness(1, 31);
    PA_SetBrightness(0, 31);
    // Load the title background at the top screen
    PA_EasyBgLoad(1, 3, title);
    // Change the brightness of the top screen to neutral (fading)
    for (l_i = 31; l_i >= 0; l_i--) {
        PA_SetBrightness(1, l_i);
        PA_WaitForVBL();
        PA_WaitForVBL();
    }
    // Create the sprites for the two castles below the grass level
    PA_DualCreateSprite(SPRITE_NB_CASTLE1_PART1, (void*)topcastle_Sprite,
                        OBJ_SIZE_64X64, 1, PALETTE_NB_CASTLE,
                        69, 192-position_castle);
    PA_DualCreateSprite(SPRITE_NB_CASTLE1_PART2, (void*)castle_Sprite,
                        OBJ_SIZE_64X64, 1, PALETTE_NB_CASTLE,
                        69, 192+64-position_castle);
    PA_DualCreateSprite(SPRITE_NB_CASTLE2_PART1, (void*)topcastle_Sprite,
                        OBJ_SIZE_64X64, 1, PALETTE_NB_CASTLE,
                        151, 192-position_castle);
    PA_DualCreateSprite(SPRITE_NB_CASTLE2_PART2, (void*)castle_Sprite,
                        OBJ_SIZE_64X64, 1, PALETTE_NB_CASTLE,
                        151, 192+64-position_castle);
    // Display the castle sprites behind the grass
    PA_DualSetSpritePrio (SPRITE_NB_CASTLE1_PART1, 3);
    PA_DualSetSpritePrio (SPRITE_NB_CASTLE1_PART2, 3);
    PA_DualSetSpritePrio (SPRITE_NB_CASTLE2_PART1, 3);
    PA_DualSetSpritePrio (SPRITE_NB_CASTLE2_PART2, 3);
    // Move gradually the castle sprites above the grass
    for (position_castle = 36; position_castle <= 90; position_castle++) {
        PA_WaitForVBL();
        PA_DualSetSpriteXY(SPRITE_NB_CASTLE1_PART1, 69, 192-position_castle);
        PA_DualSetSpriteXY(SPRITE_NB_CASTLE1_PART2, 69, 192+64-position_castle);
        PA_DualSetSpriteXY(SPRITE_NB_CASTLE2_PART1, 151, 192-position_castle);
        PA_DualSetSpriteXY(SPRITE_NB_CASTLE2_PART2, 151, 192+64-position_castle);
    }
    // Display the main menu
    PA_EasyBgLoad(0, 0, menu2);
    PA_SetBrightness(0, 0);
    // Wait for a player's action
    m_itemTouched = NO_MODE;
    while ((m_itemTouched == NO_MODE) || (m_itemTouched == MODE_TWOPLAYERS) || (m_itemTouched == BACK)) {
        m_itemTouched = itemTouched();
        if (m_itemTouched == MODE_INSTRUCTIONS)
            displayInstructions();
        if (m_itemTouched == MODE_TWOPLAYERS) {
            PA_DeleteBg (0, 0);
            PA_EasyBgLoad(0, 0, hotseat_wifi);
        }
        if (m_itemTouched == BACK) {
            PA_DeleteBg (0, 0);
            PA_EasyBgLoad(0, 0, menu2);
        }
        PA_WaitForVBL();
    }
    // Delete the castle sprites
    PA_DualDeleteSprite(SPRITE_NB_CASTLE1_PART1);
    PA_DualDeleteSprite(SPRITE_NB_CASTLE1_PART2);
    PA_DualDeleteSprite(SPRITE_NB_CASTLE2_PART1);
    PA_DualDeleteSprite(SPRITE_NB_CASTLE2_PART2);
    // Load the empty bottom screen
    PA_EasyBgLoad(0, 3, bottomscreen);
    // Activate the Wifi
    if (m_itemTouched == MODE_WIFI) {
        PA_DeleteBg (0, 0);
        PA_EasyBgLoad(1, 2, opponentchoice);
        l_wifi.goToState(WIFI_STATE_ACTIVE);
        m_playerOrder = l_wifi.connection();
    }
    // Fading to white at the top screen
    for (l_i = 0; l_i <=31; l_i++) {
        PA_SetBrightness(1, l_i);
        PA_WaitForVBL();
        PA_WaitForVBL();
    }
    // Start to play the music
#ifndef DEBUG
    AS_SetMP3Loop(true);
    AS_SetMP3Volume(m_musicVolume);
    AS_MP3DirectPlay((u8*)sound9, (u32)sound9_size);
#endif
    CGame l_game;  // Main game object
    // Initialise the game object where m_itemTouched corresponds to the game mode
    l_game.initGame(m_musicVolume, m_cardSpeed, m_itemTouched, m_playerOrder);
    // Infinite loop to keep the program running
    bool finish = false;
    while(!finish) {
        // Play the game
        finish = l_game.play(&m_musicVolume, &m_cardSpeed);
        PA_WaitForVBL();
    }
    // Stop the music
#ifndef DEBUG
    AS_MP3Stop();
#endif
}