Exemple #1
0
void grlib_DrawPart (int x, int y, int w, int h, int tx, int ty, int tw, int th, GRRLIB_texImg * tex, f32 angle, u32 color)
	{
	f32 zx, zy;
	
	if (!tex) return;
	
	zx = (f32)w / (f32)tw;
	zy = (f32)h / (f32)th;
	
	GRRLIB_DrawPart (x, y, tx, ty, tw, th, tex, angle, zx, zy, color);
	}
Exemple #2
0
void cui_board_display(cui_board *board, GRRLIB_texImg* tex_pieces, GRRLIB_texImg* tex_tile, GRRLIB_ttfFont* font, int cursor_x, int cursor_y){
  unsigned int i;
  unsigned int x=0, y=0;
    
  int offset_x = 140;
  int offset_y = 80;

  for(i=0;i<8;i++){
    char board_alpha[2] = {i + 'A'};
    GRRLIB_PrintfTTF (i*40+offset_x+20, offset_y + 8*40 + 16/2, font, board_alpha, 16, 0xFFFFFFFF);	
  }

  for (i = 0; i < CUI_TILE_NB; i++) {

    u32 tile_color;
    if(x == cursor_x && y == cursor_y){
      tile_color = 0x223388FF;
    }else tile_color = board->tile[i].color;
		
    GRRLIB_DrawImg(x*40+offset_x, y*40+offset_y, tex_tile, 0, 1, 1, tile_color);
        
    if ((i & 7) == 7){
      char board_num[2];
      snprintf(board_num, 2, "%d", 8-y);
      GRRLIB_PrintfTTF (offset_x - 20, y*40+offset_y + 16/2, font, board_num, 16, 0xFFFFFFFF);
			
      y++;
      x=0;
    }else{			
      x++;
    }
  }
   
  x=y=0;
  offset_x++;
  offset_y = 11;
  for (i = 0; i < CUI_TILE_NB; i++) {

    if (board->piece[i] != CUI_EMPTY){
      u32 piece_color = (board->color[i] == CUI_WHITE ? board->piece_color1 : board->piece_color2);
      GRRLIB_DrawPart(x*40+offset_x, y*40+offset_y, board->piece[i]*40, 0, 40, 100, tex_pieces, 0, 1, 1, piece_color);
    }
        
    if ((i & 7) == 7){
      y++;
      x=0;
    }else x++;
  }
}