//途中経過表示 //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);//描画する画像の色光度を再設定 }
//収穫した米の種類を表示 //int&はwords,numbersの順 //Rice_Dat* 田んぼ情報 //words 文字画像のハンドル //numbers 数字画像のハンドル void Display::collected_rice(Rice_Dat* rice, int& words, int& numbers){ int bad = 0, gold = 0, norm = 0; int i,j; for (i = 0; i < 10; i++){ if (rice[i].exist){ for (j = 0; j < 10; j++){ switch (rice[i].type[j]){ case 1://出来損米 bad++; break; case 2://普通米 norm++; break; case 3://黄金米 gold++; break; } } } } //紫のウィンドウ DrawFillBox(320, 192, 960, 576, Colors::Purple); //出来損米 DrawRectGraph(330, 200, 0, 300, 144, 37, words, true, false); dispNum_inf(500, 200, 18, 37, 0, 0, bad, 0, numbers); //普通米 DrawRectGraph(330, 240, 150, 300, 108, 37, words, true, false); dispNum_inf(500, 240, 18, 37, 0, 0, norm, 0, numbers); //黄金米 DrawRectGraph(330, 280, 300, 300, 108, 37, words, true, false); dispNum_inf(500, 280, 18, 37, 0, 0, gold, 0, numbers); }
void cPlayer::draw(){ int i = 0; // 左端 DrawRectGraph( static_cast<int>(this->X) , static_cast<int>(this->Y), this->PicSrcX , this->PicSrcY , this->PicHeight , this->PicHeight , this->GHandle , true , false ); DrawRectGraph( static_cast<int>(this->X) + this->PicHeight , static_cast<int>(this->Y), this->PicSrcX + this->PicHeight , this->PicSrcY , this->PicWidth - this->PicHeight*2, this->PicHeight , this->GHandle , true , false ); // 追加分描画 for(i = 0 ; i < this->additionalWidth ; i++){ DrawRectGraph( static_cast<int>(this->X) + this->PicWidth - this->PicHeight + i, static_cast<int>(this->Y), this->PicSrcX + this->PicHeight , this->PicSrcY , 1, this->PicHeight , this->GHandle , true , false ); } // 右端描画 DrawRectGraph( static_cast<int>(this->X) + this->PicWidth - this->PicHeight + static_cast<int>(this->additionalWidth), static_cast<int>(this->Y), this->PicSrcX + this->PicWidth - this->PicHeight, this->PicSrcY , this->PicHeight , this->PicHeight , this->GHandle , true , false ); }
//ステータス表示 //int& stats //stats ステータス文字画像のハンドル void Display::stats(int& stats){ SetDrawBright(0, 0, 0);//描画する画像の色光度を設定(黒) int y = 0, m = 0, w = 0; if (year > 9) y = 12;//2ケタの時に表示位置をずらす if (month > 9) m = 12;//2ケタの時に表示位置をずらす if (weeks > 9) w = 12;//2ケタの時に表示位置をずらす //年 dispNum(40, 10, 12, 25, 0, 0, year, 0, stats); DrawRectGraph(62 + y, 10, 0, 50, 48, 26, stats, true, false); //月 dispNum(120 + y, 10, 12, 25, 0, 0, month, 0, stats); DrawRectGraph(142 + m + y, 10, 50, 50, 24, 26, stats, true, false); //週 dispNum(180 + y + m, 10, 12, 25, 0, 0, weeks, 0, stats); DrawRectGraph(202 + y + m + w, 10, 75, 50, 48, 26, stats, true, false); //お金 dispNum(1020, 10, 12, 25, 0, 0, money, 0, stats); DrawRectGraph(950, 10, 175, 50, 48, 26, stats, true, false); //体力 dispNum(620, 10, 12, 25, 0, 0, health, 0, stats); DrawRectGraph(550, 10, 125, 50, 48, 26, stats, true, false); SetDrawBright(255, 255, 255);//描画する画像の色光度を設定(白) }
void draw_main() { if(GetNowCount() - Csystem::start_time > 90000) return; SetUseZBuffer3D( TRUE ); SetWriteZBuffer3D( TRUE ); ChangeLightTypePoint( VGet(0,500,0), 1000, 2, 0, 0 ) ; draw_wall(VGet(-500,1000,-500),VGet(-500,1000,500),VGet(500,1000,500),VGet(500,1000,-500), VGet(-500,0,-500),VGet(-500,0,500),VGet(500,0,500),VGet(500,0,-500)); Pplayer->Preticle->draw(); if(Pplayer->target_type == Cplayer::FREE) { Pplayer->draw(); Pplayer->Pright_arm->right_draw(); Pplayer->Pleft_arm->left_draw(); } int player_hp = 254 * Pplayer->hit_point/1500; DrawRectGraph(80,14,0,0,player_hp,25,player_hp_g,TRUE,FALSE); switch (Csystem::game_mode) { case Csystem::SOLO: Pboss->draw(); DrawRectGraph(1195-(254 * Pboss->hit_point/4193),14,254 -(254 * Pboss->hit_point/4193),0,254,25,enemy_hp_g,TRUE,FALSE); break; case Csystem::ONLINE: Penemy->draw(); DrawRectGraph(1195-(254 * Penemy->hit_point/1500),14,254 -(254 * Penemy->hit_point/1500),0,254,25,enemy_hp_g,TRUE,FALSE); break; } for(int i = 0;i < 4;i++) { for(int k = 0;k < AMMO_MAX;k++) { Pplayer->Pleft_shot[i][k]->draw(); Pplayer->Pright_shot[i][k]->draw(); } } for(int k = 0;k < AMMO_MAX;k++) { Pboss->Pshot[k]->draw(); } DrawGraph(0,0,hp_bar_g,TRUE); Pcamera->draw(); #ifdef _DEBUG DrawFormatString(800,0,0x000fff,"%d",GetJoypadInputState( DX_INPUT_PAD1 )); DrawFormatString(0,20,0x000000,"X座標:%6f",Pplayer->pos.x); DrawFormatString(0,40,0x000000,"Y座標:%6f",Pplayer->pos.y); DrawFormatString(0,60,0x000000,"Z座標%6f",Pplayer->pos.z); DrawFormatString(460,0,0x000000,"敵撃破数%3d",Csystem::destroy_enemy); DrawFormatString(460,20,0x000000,"経過時間%2d秒",(GetNowCount() - Csystem::start_time)/1000); #endif }
void CObject_Bg_Stage4_5::Render() { int _width = 0; int _height = 0; SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); GetGraphSize(GraphHandle, &_width, &_height); DrawRectGraph((int)fDrawX, (int)fDrawY, SrcX, SrcY, 1024, 768, GraphHandle, TRUE, FALSE); DrawRectGraph((int)fDrawX, (int)fDrawY, (SrcX-_width), SrcY+768, 1024, 768, GraphHandle, TRUE, FALSE); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); }
//売上表示 //int&はnumbers,words,bad,norm,gold,sell_totalの順 //numbers 数字画像のハンドル //words 文字画像のハンドル //bad 出来損米カウンタ //norm 普通米カウンタ //gold 黄金米カウンタ //sell_total 売上総額 void Display::sellings(int& numbers, int& words, int& bad, int& norm, int& gold, int& sell_total){ //出来損米 DrawRectGraph(800, 200, 0, 300, 144, 37, words, true, false); dispNum_inf(1000, 200, 18, 37, 0, 0, bad, 0, numbers); //普通米 DrawRectGraph(800, 300, 150, 300, 108, 37, words, true, false); dispNum_inf(1000, 300, 18, 37, 0, 0, norm, 0, numbers); //黄金米 DrawRectGraph(800, 400, 300, 300, 108, 37, words, true, false); dispNum_inf(1000, 400, 18, 37, 0, 0, gold, 0, numbers); //売上総額 dispNum_inf(1000, 600, 18, 37, 0, 0, sell_total, 0, numbers); }
void CObject_Bg_Stage1_2::Render() { int _width = 0; int _height = 0; SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); GetGraphSize(GraphHandle, &_width, &_height); DrawRectGraph((int)fDrawX, (int)fDrawY, SrcX, SrcY, 1024, 768, GraphHandle, TRUE, FALSE); DrawRectGraph((int)fDrawX, (int)fDrawY, (SrcX-_width), SrcY+768, 1024, 768, GraphHandle, TRUE, FALSE); SetDrawBlendMode(DX_BLENDMODE_ALPHA, Hero->GetOpacity()); DrawGraphF(1160 - SrcX, 180, GetResourceWithKey(IMAGE_STAGE1_2_FOREST), TRUE); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); }
void Graphics2D::DrawRasterScroll(const int& X, const int& Y, double Cycle, double Shake, const int& Gr_Handle, bool isVertical) { int Width = 0, Height = 0; // 画像の横幅と縦幅 static int Correction = 0; // ラスタースクロールの補正 GetGraphSize(Gr_Handle, &Width, &Height); // 画像のサイズを得る switch (isVertical) { case true : for (int I = 0; I < Height; ++I) { const int& DestX = X - Width / 2 + std::cos((I + Correction) / 180.0 * DX_PI * Cycle) * Shake; // cosの値で左右に揺らす const int& DestY = Y - Height / 2 + I; // 画像の分割描画(縦に1pixずつ) DrawRectGraph( DestX, DestY, 0, I, Width, 1, Gr_Handle, TRUE, FALSE ); } break; case false : for (int I = 0; I < Width; ++I) { const int& DestX = X - Width / 2 + I; const int& DestY = Y - Height / 2 + std::cos((I + Correction) / 180. * DX_PI * Cycle) * Shake; // 画像の分割描画(横に1pixずつ) DrawRectGraph ( DestX, DestY, I, 0, 1, Height, Gr_Handle, TRUE, FALSE ); } break; } ++Correction; }
void cSceneGameOver::draw(){ SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128); DrawRectGraph( 0, 0, 0, 0, 800, 600, this->GHandleBk , true , false ); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); DrawRectGraph( 141, 155, 0, 0, 517, 93, this->GHandleGameOver , true , false ); DrawRectGraph( 337, 380, 0, 0, 127, 48, this->GHandleTitle , true , false ); }
//本編の文字表示 //int&はnumbers,wordsの順 //numbers 数字画像のハンドル //words 文字画像のハンドル void Display::game_words(int& numbers, int& words){ SetDrawBright(0, 0, 0);//描画する画像の色光度を設定(黒) //進む DrawRectGraph(100, 700, 150, 50, 72, 37, words, true, false); //休む DrawRectGraph(1065, 350, 400, 50, 72, 37, words, true, false); //しょっぷ DrawRectGraph(1020, 550, 250, 50, 144, 37, words, true, false); //育成 DrawRectGraph(1065, 150, 650, 50, 72, 37, words, true, false); SetDrawBright(255, 255, 255);//描画する画像の色光度を設定(白) }
void Button::Draw() const { DrawRectGraph( static_cast<int>(m_pos.x), static_cast<int>(m_pos.y), 0, 0, static_cast<int>(m_size.x), static_cast<int>(m_size.y), ImageHandleOf(static_cast<ImageType>(m_image_handle)), TRUE, FALSE); // DrawTexture( m_pos , static_cast<ImageType>(m_image_handle) ); DrawCollision(); DrawFormatString( (int)m_pos.x , (int)m_pos.y, ColorOf(0,255,0) , "%s", m_name.c_str() ); }
void AnimTexture::Draw( Vector2 const& camera_pos ) const { int const width = static_cast<int>(m_anim_data.width); int const height = static_cast<int>(m_anim_data.height); DrawRectGraph( static_cast<int>(m_pos.x - camera_pos.x), static_cast<int>(m_pos.y - camera_pos.y), m_anim_data.begin_x + width*m_current_index, m_anim_data.begin_y, m_anim_data.width, m_anim_data.height, m_image_handle, TRUE, FALSE ); }
//タイトル表示 //int&,bool&はTitle_Words,New,Contの順 //Title_Words タイトル文字の画像ハンドル //New,Cont はじめから、もしくはつづきから判定 void Display::title(int& Title_Words,bool& New,bool& Cont){//タイトル表示 Mouse mouse;//マウスポイント格納集合体 GetMousePoint(&mouse.x, &mouse.y);//マウスポイント取得 SetDrawBright(255, 153, 51);//描画する画像の色光度を設定 DrawRectGraph(240, 100, 0, 0, 800, 81, Title_Words, true, false);//新米ふぁ〜む //はじめから //描画する色の分岐処理 if (Mouse_Sq(370, 400, 540, 81, mouse)){ SetDrawBright(255, 102, 102); if (GetMouseInput_Once(Mouse_Buttons::Left)){//マウスボタン押されたら、アドレス先にtrueを返す New = true; } } else { SetDrawBright(102, 178, 255); } DrawRectGraph(370, 400, 0, 100, 540, 61, Title_Words, true, false);//はじめから //つづきから //描画する色の分岐処理 if (Mouse_Sq(370, 600, 540, 81, mouse)){ SetDrawBright(255, 102, 102); if (GetMouseInput_Once(Mouse_Buttons::Left)){//マウスボタン押されたら、アドレス先にtrueを返す Cont = true; } } else { SetDrawBright(102, 178, 255); } DrawRectGraph(370, 600, 0, 200, 540, 61, Title_Words, true, false);//つづきから SetDrawBright(255, 255, 255);//描画する画像の色光度を再設定 }
void Image::DrawImage(int x, int y, int GrIndex, bool TransFlag, int div, bool adj) { Image_t* img = img_db.QueryImgData(GrIndex); if(div > img->div_num-1) div = img->div_num-1; int adj_x = GAME_X; int adj_y = GAME_Y; if(!adj) { adj_x = 0; adj_y = 0; } int img_w, img_h; GetGraphSize(img->img_han,&img_w,&img_h); int per_w = img_w/img->div_num; DrawRectGraph(x+adj_x,y+adj_y,per_w*div,0,per_w,img_h,img->img_han,TransFlag,FALSE); }
void Graphics2D::Raster_Scroll(const int &X, const int &Y, const int &Gr_Handle, double Cycle, double Shake) { int Width = 0, Height = 0; // 画像の横幅と縦幅 int Correction = 0; // ラスタースクロールの補正 GetGraphSize(Gr_Handle, &Width, &Height); for (int I = 0; I < Height; ++I) { const int DestX = X - Width / 2 + std::cos((I + Correction) / 180.0 * DX_PI * Cycle) * Shake; const int DestY = Y - Height / 2 + I; DrawRectGraph ( DestX, DestY, 0, I, Width, 1, Gr_Handle, TRUE, FALSE ); } ++Correction; }
//画像の指定した部分のみ描画 描画座標・左上座標・描画画像サイズ void DrawImpl::trim(const Vector2& pos, const Vector2& graph_ul_pos, const Vector2& size, int GrHandle, int alpha, int TurnFlag, int blendMode){ SetDrawBlendMode(blendMode, alpha); DrawRectGraph(pos.x + dx, pos.y + dy, graph_ul_pos.x, graph_ul_pos.y, size.x, size.y, GrHandle, 1, TurnFlag); }
void Drawer::drawNum( int x, int y, int num ) { //後、10以上でも対応するように。<math.h> DrawRectGraph( x, y, num * NUMBER_SIZE, 0, NUMBER_SIZE, NUMBER_SIZE, _num_img, TRUE, FALSE ); }