Exemple #1
0
void GraphicManager::MoveFade(int fade_left, int fade_frame) {
    for (int i=0;i<GlobalValue::LayerMax;i++) {
        if (layer[i].enable) {
            DrawGraph(GlobalValue::WindowX*(fade_left-fade_frame)/fade_frame+layer[i].x,layer[i].y,layer[i].handle,TRUE);
        }
    }
    for (int i=0;i<GlobalValue::LayerMax;i++) {
        if (layer_back[i].enable) {
            DrawGraph(GlobalValue::WindowX*fade_left/fade_frame+layer_back[i].x,layer_back[i].y,layer_back[i].handle,TRUE);
        }
    }
}
Exemple #2
0
// 説明画面表示
void Display::Introduction()
{
	// 説明画面画像の読み込みと表示
	if(IsQuarter == IDYES){
		GraphHandle_Introduction = LoadGraph("img\\q_introduction.png");
		DrawGraph(0, 0, GraphHandle_Introduction, TRUE);
	}else{
		GraphHandle_Introduction = LoadGraph("img\\n_introduction.png");
		DrawGraph(0, 0, GraphHandle_Introduction, TRUE);
	}
	//ScreenFlip();
}
Exemple #3
0
void OpeningDraw() {
	OpeiningCount++;
	if (OpeiningCount >= 1 && OpeiningCount != 0) {
		int OpeiningCountFrame = (OpeiningCount / 120); 
		if ((OpeiningCount / 120) > 3) {
			OpeiningCountFrame = 3;
		}
		DrawGraph(0, 0, Opening[OpeiningCountFrame], TRUE);
	} else {
		DrawGraph(0, 0, Opening[0], TRUE);
	}
}
void DrawCharaGraph(int num){
	switch(num){
	case 1:
		DrawGraph(400,50,graph::chara[0],true);
		break;
	case 2:
		DrawGraph(50,50,graph::chara[1],true);
		break;
	case 3:
		DrawGraph(200,50,graph::chara[2],true);
		break;
	}
}
Exemple #5
0
void GraphicManager::CrossFade(int fade_left, int fade_frame) {
    SetDrawBlendMode(DX_BLENDMODE_ALPHA,255*(fade_frame-fade_frame_left)/fade_frame);
    for (int i=0;i<GlobalValue::LayerMax;i++) {
        if (layer_back[i].enable) {
            DrawGraph(layer_back[i].x,layer_back[i].y,layer_back[i].handle,TRUE);
        }
    }
    SetDrawBlendMode(DX_BLENDMODE_ALPHA,255*fade_frame_left/fade_frame);
    for (int i=0;i<GlobalValue::LayerMax;i++) {
        if (layer[i].enable) {
            DrawGraph(layer[i].x,layer[i].y,layer[i].handle,TRUE);
        }
    }
}
Exemple #6
0
void graph_boss(){
	int i;
	if(boss.flag==0)return;
	graph_boss_effect();
	DrawRotaGraphF(boss.dx+FX+dn.x,boss.dy+FY+dn.y,
		1.0f,0.0f,img_dot_riria[0],TRUE);
	if(boss.hp_max==0){printfDx("graph_boss内0割り\n");return;}
	for(i=0;i<FMX*0.98*boss.hp/boss.hp_max;i++){
		if(boss.back_knd[boss.knd]==1)
			DrawGraph(3+FX+i+dn.x,2+FY+dn.y,img_etc[7],FALSE);
		else
			DrawGraph(3+FX+i+dn.x,2+FY+dn.y,img_etc[1],FALSE);
	}
}
Exemple #7
0
void Mobu::Draw1(int movex,int movey){
	extern int cell;
	//静止状態
	if(!hide){
		if(!mobumove){
			movecount = 0;
			DrawGraph(cell*7+cell/2 + fieldx*cell + movex,cell*7+cell/2 + fieldy*cell + movey,src[srcSelect],TRUE );
		}
		//移動中
		else{
			movecount++;
			DrawGraph(cell*7+cell/2 + fieldx*cell + movex + mobumovex,cell*7+cell/2 + fieldy*cell + movey + mobumovey,src[srcSelect + movecount/4%4],TRUE );
		}
	}
}
Exemple #8
0
void MusicApple::Draw()
{
	GetMousePoint(&mousex, &mousey);
	if(sqrt(pow(((double)mousex-x), 2)+pow(((double)mousey-y), 2)) <= hit_area){
		hit_area = 90;
		//DrawCircle(this->x, this->y, hit_area, this->color, true);
		DrawGraph(this->x-100, this->y-108, graphic_h_b, true);
	}else{
		hit_area = 30;
		//DrawCircle(this->x, this->y, MUSICAPPLE_HIT_AREA, this->color, true);
		DrawGraph(this->x-34, this->y-37, graphic_h_s, true);
	}
	
	//DrawCircle(this->x, this->y, 30, this->color, true);
}
Exemple #9
0
int Battle( Character_t *Character, int EnemyType){	
	DrawGraph(0,0,BackGround,TRUE);
	MessageFrame();
	DrawFormatString( 60, 140, GetColor(255, 255, 255), " LV:%d ",Character->LEVEL) ;

	DrawGauge( 15, 16, Character->MaxHP, Character->HP, GetColor( 0, 255, 0 ), GetColor(0, 255/2, 0),TRUE);
	DrawGauge( 15, 31, Character->MaxMP, Character->MP, GetColor( 255, 255, 0 ),GetColor( 255/2, 255/2, 0 ),TRUE );

	DrawGraph(Enemy[EnemyType].X, Enemy[EnemyType].Y, Enemy[EnemyType].Graph, TRUE);
	// 現れたとこ
	if(move==0){if(DrawBattleMessage( 0, 2, BattleMenuString, 0, EnemyType, TRUE) == 1 )move=1;}


	// 選択
	if(move==1)switch( DrawMenu( 2, 2, KEY_INPUT_Z, BattleMenu) ){
	// 速度判定
	case 0:backmenu=0;if( Character->Speed >= Enemy[EnemyType].Speed ){
		Damage=DamageCalc2( *Character, &Enemy[EnemyType]);move=3;
		   }else {
			   Damage=DamageCalc2( Enemy[EnemyType], Character);move=5;
		   }break;
	case 1:break;
	case 2:move=2;break;
	case 3:break;
	}

	//逃げ出す勇者の処理
	if(move==2)if( DrawBattleMessage( 2, 3, BattleMenuString, 0, EnemyType,FALSE) == 1 ){move=0;Enemy[EnemyType].HP = Enemy[EnemyType].MaxHP ;return 2;}



	// 的にダメージを与える処理 中かっこの中には勝った時の処理
	if(move==3)if(DamageCalc3( Character, &Enemy[EnemyType], 3, 5, 5, EnemyType, FALSE)==1){ 
			Character->Ex += Enemy[EnemyType].Ex ; 
			Enemy->HP = Enemy[EnemyType].MaxHP ; 
			move=0 ; 
			return 2 ;
		}

	// 敵のダメージを与える分を表示 中かっこの中には負けた時の処理
	if(move==5)if(DamageCalc3( &Enemy[EnemyType], Character, 5, 7, 3, EnemyType, TRUE)==1){
			move=0 ;
			return 0 ;
		}
	

	return 4 ;
}/*
Exemple #10
0
/*背景描画*/
void TextGraphClass::DrawBack(UserClass &User){
	//背景描画
	switch( User.GetBackCode() ){
		case GAME_BACK::KAWARA:
			DrawGraph(GameBackPoint[GRAPH::X],GameBackPoint[GRAPH::Y],GameBackHandle[GAME_BACK::KAWARA],TRUE);
		break;	
	
		case GAME_BACK::YOZORA:
			DrawGraph(GameBackPoint[GRAPH::X],GameBackPoint[GRAPH::Y],GameBackHandle[GAME_BACK::YOZORA],TRUE);
		break;

		case GAME_BACK::BLACK:
			DrawBox(0,0,windowX,windowY,GetColor(0,0,0),TRUE);
		break;
	}
}
Exemple #11
0
void NetworkWidget::DoUpdate()
{
   QFile f(QString(GetFile("/proc/net/dev", false).c_str()));
   f.open(QIODevice::ReadOnly);
   QTextStream stream(&f);
   QString contents = stream.readAll();
   f.close();
   contents.replace(":", " ");
   contents.replace("\n", " ");
   
   size_t val = 0;
   QStringList l = contents.split(" ", QString::SkipEmptyParts);
   for (size_t i = 0; i < l.length(); ++i)
   {
      if (l[i].toStdString() == interface)
      {
         if (down)
         {
            // On 32-bit archs it's possible to overflow size_t, so truncate to only the
            // last nine digits.  If you need to be able to measure more than a gigabyte of
            // bandwidth, switch to 64-bits. :-)
            if (sizeof(val) > 4)
               val = l[i + 1].toULong();
            else
               val = l[i + 1].right(9).toULong();
         }
         else
         {
            if (sizeof(val) > 4)
               val = l[i + 9].toULong();
            else
               val = l[i + 9].right(9).toULong();
         }
         break;
      }
   }
   size_t currbytes = val;
   int elapsed = timer.restart();
   float rate = (currbytes - lastbytes) / (float(elapsed) / 1000.f) / float(KB());
   rate = floor(rate * 10.f) / 10.f;
   lastbytes = currbytes;
   float percent = rate / max;
   
   if (type == Text)
   {
      QString qrate;
      qrate.setNum(rate);
      QString text = format;
      text.replace("%s", qrate);
      SetText(text);
   }
   else if (type == Image)
   {
      SetLabelMask(percent);
   }
   else if (type == Graph)
   {
      DrawGraph(percent);
   }
}
Exemple #12
0
void CBoard::draw(int point, int quota, std::string statement1, std::string statement2) {

	// 背景画像
	DrawGraph(0, 0, ghandle_background, TRUE);

	// 箱が通る線
	DrawBox(0, 295, 800, 305, blue, TRUE);
	DrawBox(450, 295, 600, 305, red, TRUE);

	// 説明文
	DrawFormatStringToHandle(30, 120, white, font3, "ベルトレーラーが光っている時,");
	DrawFormatStringToHandle(30, 150, white, font3, "答えが正解だと思ったらZキーを押そう。");
	DrawFormatStringToHandle(30, 180, white, font3, "違うと思ったらスルーだ!");

	// 得点表示
	DrawFormatStringToHandle(600, 500, white, font1, "得点:");

	if(point > quota) DrawFormatStringToHandle(690, 500, light_blue, font1, "%d", point);

	else if(point == quota) DrawFormatStringToHandle(690, 500, white, font1, "%d", point);

	else DrawFormatStringToHandle(690, 500, light_red, font1, "%d", point);
		
	// ノルマ表示
	DrawFormatStringToHandle(50, 500, white, font1, "ノルマ: %d", quota);

	// 問題文表示
	DrawFormatStringToHandle(50, 50, white, font1, statement1.c_str());
	DrawFormatStringToHandle(50, 80, white, font1, statement2.c_str());

}
Exemple #13
0
/*背景描画*/
void SecretGraphClass::DrawBack(){
	DrawGraph(BackgroundPoint[GRAPH::X],BackgroundPoint[GRAPH::Y],BackgroundHandle,TRUE);
	SetDrawBlendMode(DX_BLENDMODE_ALPHA,120);
	DrawBox(50,50,windowX-50,windowY-50,GetColor(0,0,0),TRUE);
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND,0);
	DrawLine(500,100,500,windowY-100,GetColor(0,0,0));
}
//@Anten,@Meiten,@BackGround_Change用のフェードインアウト処理
void CWorldManager::FadeDraw(int _time, int _img, bool _changeahead, bool _color){
    int starttime = GetNowCount() ;
	int alpha;

	if (!_color && !_changeahead) {int tmp = _img; _img = ImgBackGround; ImgBackGround = tmp;}

    while(GetNowCount()-starttime<_time){
		if (_changeahead){
			alpha = 255 * (GetNowCount()-starttime)/_time;
		}else{
			alpha = 255 - 255 * (GetNowCount()-starttime)/_time;
		}
		
		SetDrawBlendMode( DX_BLENDMODE_NOBLEND , 0 );	
		Draw(false, true);		//Draw()内でScreenFlipなどはしない

		SetDrawBlendMode( DX_BLENDMODE_ALPHA, alpha);
		if (_color){
			DrawBox(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, _img, true);	//DrawBox使わない方が軽いらしい$
		}else{
			CVector picsize = GetGraphSize(_img);
			DrawGraph(WINDOW_WIDTH/2-picsize.x/2, WINDOW_HEIGHT/2-picsize.y/2, _img, true);
		}

		if(!BasicLoop() ) break;
	}
	
	if (!_color && _changeahead) ImgBackGround = _img;
	SetDrawBlendMode( DX_BLENDMODE_NOBLEND , 0 );	
}
Exemple #15
0
void Ocean::on_clearButton_clicked()
{
    ui->SizeFieldBox->setEnabled(true);
    ui->generationButton->setEnabled(true);
    ui->comboBox->setCurrentIndex(0);
    ui->AmountStones->setEnabled(true);
    ui->Amount_Predators->setEnabled(true);
    ui->Amount_Victims->setEnabled(true);
    ui->deadStep_Predators->setEnabled(true);
    ui->razmnozh_Predators->setEnabled(true);
    ui->razmnozh_Victims->setEnabled(true);
    ui->countPredators->setText(QString::number(ui->Amount_Predators->value()));
    ui->countVictims->setText(QString::number(ui->Amount_Victims->value()));

    predators.erase(predators.begin(), predators.end());
    victims.erase(victims.begin(), victims.end());

    for (int i = 0; i < SizeField; i++)
        for (int j = 0; j < SizeField; j++)
            area[i][j].who=0;

    massPointVictims.erase(massPointVictims.begin(), massPointVictims.end());
    massPointPredators.erase(massPointPredators.begin(), massPointPredators.end());
    DrawGraph(predators.size(), victims.size());
    ocean->RecieveInit(area);
}
Exemple #16
0
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
	ChangeWindowMode(TRUE);
	DxLib_Init();
	SetDrawScreen(DX_SCREEN_BACK);

	int handle = LoadGraph("image/backGround.png");

	GameManager *gameMgr;
	gameMgr = new GameManager();

	/*初期化処理*/
	gameMgr->initialize();

	while (!ProcessMessage() && !ScreenFlip() && !ClearDrawScreen())
	{
		/*キーボードアップデート*/
		KeyboardInput::Instance()->update();
		if (KeyboardInput::Instance()->get(KEY_INPUT_ESCAPE) == 1){ break; }


		DrawGraph(0, 0, handle, FALSE);

		/*メイン処理*/
		gameMgr->execute();

	}
	/*終了処理*/
	gameMgr->finalize();
	delete gameMgr;

	DxLib_End();

	return 0;
}
void Scene_Battle::DrawBG() const{
	// マップ画面の描画
	if(g_temp.hBGHandle != -1){
		DrawGraph(0, 0, g_temp.hBGHandle, 0);
	}
	// 枠
	float rate;
	if(SceneIsReserved()){
		rate = 1.00*(BATTLE_END_TIME-reservedCount)/BATTLE_END_TIME;
	}else{
		rate = 1.00*sceneTime/BATTLE_START_TIME;
	}
	rate = max(0.01, min(1.0, rate));

	int l, r, t, b;
	l = (WND_WIDTH-BATTLE_WINDOW_WIDTH)/2;
	t = BATTLE_WINDOW_CY-rate*BATTLE_WINDOW_HEIGHT/2;
	r = (WND_WIDTH+BATTLE_WINDOW_WIDTH)/2;
	b = BATTLE_WINDOW_CY+rate*BATTLE_WINDOW_HEIGHT/2;
	DrawBox(
		l-2, t-2, r+2, b+2,
		GetColor(255,255,255), 1);
	DrawBox(
		l, t, r, b,
		GetColor(0, 0, 0), 1);

	// DrawBox(0, 0, WND_WIDTH, WND_HEIGHT, 0x000000ff, 1);
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
	// 背景描画エリアの限定
	SetDrawArea(l, t, r, b);

	// エフェクト背景の描画
	bgEffect.Draw();

}
Exemple #18
0
// しっぽの描画
void Display::tail_disp(int numX, int numY, int DrawPointX, int DrawPointY)
{
	// tail_arrayの0番目は欠番。尻尾の座標情報は1番目から
	for(int tailCount = 1; tailCount <= Player_Length; tailCount++){
		DrawGraph((tail_array[tailCount].chara_x - DrawPointX)*ChipSizeX, (tail_array[tailCount].chara_y - DrawPointY)*ChipSizeY, GraphHandle_Tail, TRUE);
	}
}
Exemple #19
0
// Handle WM_PAINT.
void MyGraph::OnPaint()
{
	VALIDATE;

	CBufferDC dc(this);
	DrawGraph(dc);
}
Exemple #20
0
void DrawMap() {
	for (int y = 0; y < MAP_HEIGHT; y++) {
		for (int x = 0; x < MAP_WIDTH; x++) {
			DrawGraph(x*IMG_CHIPSIZE, y*IMG_CHIPSIZE, g_imghandles.field, FALSE);
			//マップアイテム描画
			int c = g_mapdata[y][x];
			if (c > 0) {
				DrawGraph(
					x*IMG_CHIPSIZE,
					y*IMG_CHIPSIZE,
					g_imghandles.mapitems[c],
					TRUE);
			}
		}
	}
}
Exemple #21
0
void GraphicManager::DrawLayer() {
    if (GlobalValue::state==Transitioning) {
        switch (GlobalValue::FadeType) {
            case FadeCross:
                CrossFade(fade_frame_left,fade_frame);
                break;
            case FadeMove:
                MoveFade(fade_frame_left,fade_frame);
                break;
            case FadeCurtain:
                CurtainFade(fade_frame_left,fade_frame);
                break;
        }
        fade_frame_left--;

        if (this->fade_frame_left==0) {
            for (int i=0;i<GlobalValue::LayerMax;i++) {
                if ((layer[i].enable)&&(layer[i].handle!=layer_back[i].handle)) {
                    DeleteGraph(layer[i].handle);
                }
                layer[i]=layer_back[i];
                layer_back[i].enable=false;
            }
            GlobalValue::state=Nothing;
        }
    }else{
        for (int i=0;i<GlobalValue::LayerMax;i++) {
            if (layer[i].enable) {
                DrawGraph(layer[i].x,layer[i].y,layer[i].handle,TRUE);
            }
        }
    }
    SetDrawBlendMode(DX_BLENDMODE_NOBLEND,0);
}
Exemple #22
0
///////////////////////// OpenGL ////////////////////////////////////
void DataLoad::renderScence(void)
{
	glClear(GL_COLOR_BUFFER_BIT || GL_DEPTH_TEST);

	glViewport(0, 0, 800, 800);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();

	glOrtho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f);

	//gluPerspective(45, 1, 0.01, 1000);

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	// 버텍스 버퍼 사용

	//glEnableClientState(GL_VERTEX_ARRAY);
	//glVertexPointer()
	//glDrawArrays();
	//glDisableClientState(GL_VERTEX_ARRAY);

	Background();
	//	DrawQuad();
	DrawGraph();
	DrawData();

	glutSwapBuffers();

}
Exemple #23
0
//途中経過表示
//int&,Parameters&,bool&はBG,numbers,words,Parameters,next,endの順
//BG 背景画像のハンドル
//numbers 数字画像のハンドル
//words 文字画像のハンドル
//Parameters ゲームパラメーター
//next 次の年に進ませるフラグ
//end ゲーム終了フラグ
void Display::result(int& BG, int& numbers, int& words, Parameters& object, bool& next, bool& end){
  
  Mouse mouse;
  GetMousePoint(&mouse.x, &mouse.y);

  DrawGraph(0, 0, BG, true);
  dispNum(200, 200, 18, 37, 0, 0, year, 0, numbers);//x年目が終わりました
  if (year > 9){
    DrawRectGraph(228 + 18, 200, 0, 100, 396, 37, words, true, false);
  }
  else  DrawRectGraph(228, 200, 0, 100, 396, 37, words, true, false);
 
  DrawRectGraph(200, 300, 0, 150, 540, 37, words, true, false);//今年はこんぐらい稼げました

  if (Mouse_Sq(200, 400, 288, 37, mouse)){//次の年へ進む
    SetDrawBright(255, 0, 0);
    if (GetMouseInput_Once(Mouse_Buttons::Left)){
      next = true;
    }
  }
  else SetDrawBright(255, 255, 255);
  DrawRectGraph(200, 400, 0, 200, 288, 37, words, true, false);

  if (Mouse_Sq(200, 500, 324, 37, mouse)){//一旦きゅ〜け〜
    SetDrawBright(255, 0, 0);
    if (GetMouseInput_Once(Mouse_Buttons::Left)){
      end = true;
    }
  }
  else SetDrawBright(255, 255, 255);
  DrawRectGraph(200, 500, 0, 250, 324, 37, words, true, false);

  SetDrawBright(255, 255, 255);//描画する画像の色光度を再設定
}
Exemple #24
0
void FallingObject::Draw()
{
	if(exist == true){
		DrawGraph(this->x-33, this->y-37, graphic_h, true);
		
	}
}
void GraphHue::LoadToMap(std::string name){
	std::string loadname = "ImagesHue/" + name;
	HandleArray hArray;
	int tmp_handle = LoadGraph(loadname.c_str());
	int sizeX, sizeY;
	GetGraphSize(tmp_handle, &sizeX, &sizeY);
	for (int i = 0; i < colorNum; i++){
		hArray.arr[i] = MakeScreen(sizeX, sizeY, TRUE);
		SetDrawScreen(hArray.arr[i]);
		int hue = i * 360 / colorNum;
		SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
		Func::SetDrawBrightHSV(hue, 140, 255);
		//5回描画することで半透明の黒っぽい部分を消す
		for (int i = 0; i < 5; i++){
			DrawGraph(0, 0, tmp_handle, TRUE);
		}
	}
	SetDrawBright(255, 255, 255);

	std::vector<std::string> extensionList = { ".png", ".jpg" };
	for (auto &i : extensionList){
		Func::strReplace(name, i, "");
	}

	handlemap.emplace(name, hArray);
}
void ranking(AI_T ai[],int deth[]){
	int hoge,Cr;
	int j ;
	for(int i=0;i<AI_NUM;i++){

		ai[i].life = deth[i];
		j=i;
		//main関数よりdeth[]を引数に取り、小さい順に並び替え
		while(j>0&&deth[j-1]>deth[j]){
			hoge = deth[j-1];
			deth[j-1] = deth[j];
			deth[j] = hoge;
			j--;
		}
	}
	
	for(int i = 0;i<AI_NUM;i++){

		for(int k=0;k<AI_NUM;k++){

		if(ai[k].life==deth[i]){
			Cr = colswitch(i+1);

			DrawFormatString(50,200+i*20,Cr,"%d 位 %d 回",i+1,deth[i]);

			DrawString(130,200+i*20,ai[k].name,GetColor(255,0,0));

			DrawGraph(170,200+i*20,ai[k].Graph,TRUE);
		}
		}
	}

}
Exemple #27
0
//タイトルの表示
void graph_stage_title(){
	if(stage_title.flag>0){
		SetDrawBlendMode( DX_BLENDMODE_ALPHA, stage_title.brt );
		DrawGraph(120+FX+dn.x,10+FY+dn.y,stage_title.img,TRUE);
		SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0 );
	}
}
Exemple #28
0
void CEnemy::Draw(int _dx, int _dy){
	int dx=_dx+Dx; int dy=_dy+Dy;

	if (Visible){
		if (!Alive){

			static int timecount = 0;
			timecount++;
			
			//ここにエネミー死んだときのエフェクト処理を書く///$
				SetDrawBlendMode( DX_BLENDMODE_ALPHA , 240-(timecount*8)) ;

				if (timecount==30){
					timecount=0;
					Visible = false;
				}
			//////////////////////////////////////////////////////

		}
		
		DrawGraph(Rect.Left+dx, Rect.Top+dy, Img, true);
		SetDrawBlendMode( DX_BLENDMODE_NOBLEND , 0 ) ;

		Draw_Sub(_dx, _dy);
	}
}
void Game_DollUniteManager::DrawBonusListCell(int _x, int _y, BYTE _type, int _value) const{

	// 箱の描画
	DrawBox(
		_x, _y, 
		_x + UNITEMANAGER_BONUSLIST_WIDTH-1,
		_y + UNITEMANAGER_BONUSLIST_HEIGHT-1,
		GetColor(96,96,96), 1);

	// 項目の描画
	TCHAR buf[32];
	switch(_type){
	case UNITEBONUS_TYPE_SKILLKEY:
		strcpy_s(buf, 32-1, _T("スキル発見:"));
		DrawGraph(_x+148, _y+3, g_image.icon.skillKey[_value-1], 1);
		break;
	case UNITEBONUS_TYPE_SKILLNUM:
		wsprintf(buf, _T("スキル継承数: +%1d"), skillPlusNum);
		break;
	case UNITEBONUS_TYPE_UNLOCK:
		wsprintf(buf, _T("継承制限解除: +%1d"), freeSkillNum);
		break;
	case UNITEBONUS_TYPE_SKILLLEVEL:
		wsprintf(buf, _T("スキル継承P:%3dP"), carryPointBonus);
		break;
	}
	// 文字列の描画
	DrawStringByPresetColor(
		_x+20, _y+4,
		buf, g_font.hStrS, 
		PRESETCOLORSET_WHITE, COLORSET_COLOR_NORMAL);
}
Exemple #30
0
void GraphCanvas::DrawGraph(int x, int y, int w, int h) const
{
  if (!IsVisible())
    return;

  Surface &surface = GetMainWindow();
  uint   graph_h   = h-xaxis.GetHeight()-8;
  uint   graph_w   = w-yaxis.GetWidth()-8;
  uint   graph_x   = x+yaxis.GetWidth()+8;

  if (!results.empty()) {
    // Value to determine normalization
    float  max_value = 0;
    float  xmax      = 0;
    float  xmin      = std::numeric_limits<float>::max();

    for (uint i=0; i<results.size(); i++) {
      if (results[i].ymax > max_value)
        max_value = results[i].ymax;
      if (results[i].xmax > xmax)
        xmax = results[i].xmax;
      if (results[i].list[0].first < xmin)
        xmin = results[i].list[0].first;
    }
    // needed to see correctly energy at the end if two teams have same
    // energy just before the final blow
    xmax += xmax/50.0f;

    char buffer[16];
    snprintf(buffer, 16, "%.1f", xmax);
    surface.Blit(Font::GetInstance(Font::FONT_MEDIUM, Font::FONT_BOLD)->CreateSurface(buffer, black_color),
                 Point2i(x+graph_w-20, y+graph_h+8));
#if 0 // Display max y
    snprintf(buffer, 16, "%.1f", max_value);
    surface.Blit(Font::GetInstance(Font::FONT_MEDIUM, Font::FONT_BOLD)->CreateSurface(buffer, black_color),
                 Point2i(x+4, y+8));
#endif

    // Draw each team graph
    float yscale = graph_h / (1.05f*max_value);
    float xscale = graph_w / (1.05f*(xmax-xmin));

    for (uint i=0; i<results.size(); i++) {
      if (results[i].item) {
        // Legend line
        surface.BoxColor(Rectanglei(x+w-112, y+12+i*40, 56, thickness), results[i].color);
        // Legend icon
        surface.Blit(*results[i].item, Point2i(x+w-48, y+12+i*40-20));
      }
      DrawGraph(i, xmax, xmin, graph_x, xscale, y+graph_h, yscale);
    }
  }

  // Draw here the axis
  surface.BoxColor(Rectanglei(graph_x, y, thickness, graph_h), black_color);
  surface.BoxColor(Rectanglei(graph_x, y+graph_h, graph_w, thickness), black_color);
  surface.Blit(xaxis, Point2i(graph_x+graph_w/2, y+graph_h+8));
  surface.Blit(yaxis, Point2i(x+4, y+graph_h/2));
}