示例#1
0
文件: game.c 项目: SW103/BattleShip
void drawSet(AGDrawBuffer* DBuf, struct Field* field, struct Player* player)
{
	int i;

	//Init
	agDrawBufferInit( DBuf , DrawBuffer );
	agDrawSETDAVR( DBuf , 0 , 0 , aglGetDrawFrame() , 0 , 0 );
	agDrawSETDAVF( DBuf, 0, 0, s(FB_WIDTH), s(FB_HEIGHT) );

	//白背景
	agDrawSETFCOLOR( DBuf, ARGB( 255, 255, 255, 255 ) );
	agDrawSETDBMODE( DBuf, 0xff, 0, 0, 1 );
	agDrawSPRITE( DBuf, 0, 0, 0, s(FB_WIDTH), s(FB_HEIGHT) );

	//フィールド
	drawField( DBuf, field);

	//戦艦
	for(i=0;i<5;i++){
		drawBattleShip(DBuf, &(player->battleShip[i]));
	}
	

	/*
	//数字を描画する場所の白い四角
	agDrawSETFCOLOR( DBuf, ARGB( 255, 255, 255, 255 ) );
	agDrawSETDBMODE( DBuf, 0xff, 0, 0, 1 );
	agDrawSPRITE( DBuf, 0, 100-20, 100-20, 100+50*10+20, 100+90+20);
	//数字の描画
	drawNumberGraph(20131120, 100,100,50,90,10,DBuf);
	*/
	
}
示例#2
0
void drawNumberGraph(int number ,int x, int y, int size_x, int size_y , int order ,void* DBuf) 
{
	int i, n;
	int draw_x;
	int id[10] = {	AG_CG_SCORE_NUMBER_0, 
					AG_CG_SCORE_NUMBER_1, 
					AG_CG_SCORE_NUMBER_2,
					AG_CG_SCORE_NUMBER_3,
					AG_CG_SCORE_NUMBER_4,
					AG_CG_SCORE_NUMBER_5,
					AG_CG_SCORE_NUMBER_6,
					AG_CG_SCORE_NUMBER_7,
					AG_CG_SCORE_NUMBER_8,
					AG_CG_SCORE_NUMBER_9 };
					
	draw_x = x + (order-1)*size_x;

	for(i=0;i<order;i++) {
		n = number%10;
		agDrawSETFCOLOR( (AGDrawBuffer *)DBuf, ARGB( 255, 255, 0, 0 ) );
		ageTransferAAC( (AGDrawBuffer *)DBuf, id[n], 0, NULL, NULL );
		agDrawSETDBMODE( (AGDrawBuffer *)DBuf, 0xff, 0, 2, 1 );
		agDrawSPRITE( (AGDrawBuffer *)DBuf, 1, draw_x, y, draw_x+size_x, y+size_y );
		number /= 10;
		draw_x -= size_x;
	}
}