void Scene_DollUnite::DrawBonusFocus(bool _outFocus) const{ if(pBaseParent == NULL) return; if(pSubParent == NULL) return; BYTE attrPair = 0; int alpha; if(_outFocus){ alpha = 210+40*sin(0.05*sceneTime); }else{ alpha = 255; } SetDrawBright(alpha,alpha,alpha); for(int n=0; n<DOLL_ATTRSTONE_NUM; n++){ attrPair = GetAttrPair(pBaseParent->GetAttrStone(n), pSubParent->GetAttrStone(n)); for(int i=0; i<2; i++){ DrawBox( UNITEBONUS_CELL_INI_X + n * UNITEBONUS_CELL_WIDTH - i, UNITEBONUS_CELL_INI_Y + attrPair * UNITEBONUS_CELL_HEIGHT - i, UNITEBONUS_CELL_INI_X + (n+1) * UNITEBONUS_CELL_WIDTH + i, UNITEBONUS_CELL_INI_Y + (attrPair+1) * UNITEBONUS_CELL_HEIGHT + i, GetColor(255,255,128), 0); } } SetDrawBright(255,255,255); }
//ステータス表示 //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);//描画する画像の色光度を設定(白) }
//途中経過表示 //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);//描画する画像の色光度を再設定 }
void result::draw(){ SetDrawBlendMode( DX_BLENDMODE_ALPHA , 100 ) ; SetDrawBright(255,255,255); DrawRotaGraph(400, 300, 1, 0, GHandle[11] , 1); SetDrawBlendMode( DX_BLENDMODE_ALPHA , 255 ) ; SetDrawBright(255,255,255); int stry = 60; int wdx; wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1], "RESULT")); DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "RESULT") ; stry+= 80; wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1], "倒したゾンビ数: %d", ptr->menemy->dienum)); DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "倒したゾンビ数: %d", ptr->menemy->dienum) ; stry+= 80; wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1], "累積経験値: %d", ptr->mplayer->expsum)); DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "累積経験値: %d", ptr->mplayer->expsum) ; stry+= 80; wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1], "被ダメージ回数: %d", ptr->menemy->damagenum)); DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "被ダメージ回数: %d", ptr->menemy->damagenum) ; stry+= 80; wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1], "総合スコア: %ld", ptr->menemy->dienum*1000 + ptr->mplayer->expsum*10 - ptr->menemy->damagenum*200)); DrawFormatStringToHandle((int)400-wdx, (int)stry, 0xFFFFFF, FontHandle[1] , "総合スコア: %ld", ptr->menemy->dienum*1000 + ptr->mplayer->expsum*10 - ptr->menemy->damagenum*200) ; SetDrawBlendMode( DX_BLENDMODE_ALPHA , (int)(128+128*sin(keika*0.05) ) ) ; wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[1], "THANK YOU FOR PLAYING!!")); DrawFormatStringToHandle((int)400-wdx, (int)460, 0xFFFFFF, FontHandle[1] , "THANK YOU FOR PLAYING!!") ; SetDrawBlendMode( DX_BLENDMODE_ALPHA , 255 ) ; SetDrawBright(255,255,255); wdx = (int)(0.5 *GetDrawFormatStringWidthToHandle(FontHandle[0], "[スペースキーで終了]")); DrawFormatStringToHandle((int)400-wdx, (int)550, 0xFF8800, FontHandle[0] , "[スペースキーで終了]") ; ptr->meffect->draw(); }
void Scene_DollUnite::Draw() const{ // 背景の描画 SetDrawBright(128, 128, 128); DrawGraph(0, 0, g_image.bg.camp, 0); SetDrawBright(255,255,255); // 人形の一覧ウィンドウの描画 w_dollList.Draw(); // 合成ボーナスの描画 switch(state){ case SCNSTATE_DOLLUNITE_CHOOSE_FIRST: case SCNSTATE_DOLLUNITE_CHOOSE_SECOND: // 人形の情報の描画 DrawParentDollInfo(); DrawUniteBonus(); // プレビューのフェードアウト DrawPreviewDoll(previewAlpha); DrawPreviewStatus(previewAlpha); DrawPreviewSkillList(previewAlpha); DrawPreviewMenu(previewAlpha); break; case SCNSTATE_DOLLUNITE_PREVIEW: DrawPreviewDoll(previewAlpha); DrawPreviewStatus(previewAlpha); DrawPreviewSkillList(previewAlpha); DrawPreviewMenu(previewAlpha); break; case SCNSTATE_DOLLUNITE_SKILLPREVIEW: DrawPreviewDoll(previewAlpha); DrawPreviewStatus(previewAlpha); DrawPreviewSkillList(previewAlpha); DrawPreviewMenu(previewAlpha); break; }; // 情報ウィンドウの描画 wf_chooseFirst.Draw(); wf_chooseSecond.Draw(); wf_preview.Draw(); wf_confirm.Draw(); // スキルのプレビューの描画 w_skillPreview.Draw(); w_skillSelect.Draw(); // フェードの描画 DrawReserveFade(); }
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 BaseScene::Update() { //if (Mouse::getinstance()->Mouse_GetClick().leftState == CLICK_PRESS || Mouse::getinstance()->Mouse_GetClick().rightState == CLICK_PRESS) { // // クリックされたウィンドウを最前面に持ってくる処理 // for (auto &it : SceneWindowList) { // if (Useful::JudgeMouseCollisionDetectionRectPS(&(it->GetWindowPosition()), &(it->GetWindowSize()))) { // WindowToTop(it); // break; // } // } //} // 画面輝度が範囲外になっていたら修正 if (ScreenBrightness < 0) { ScreenBrightness = 0; } else if (ScreenBrightness > 255) { ScreenBrightness = 255; } // 画面輝度を設定 SetDrawBright(ScreenBrightness, ScreenBrightness, ScreenBrightness); // ウィンドウの更新を行う SceneWindowList.Update(); /* for (auto it = SceneWindowList.begin(), end = SceneWindowList.end(); it != end;) { (*it)->Update(); if ((*it)->GetDeleteFlag()) { delete *it; it = SceneWindowList.erase(it); continue; } ++it; } */ }
void Camera::drawImageOnWindow(Vec2D center_pos, int graphHandle, const std::shared_ptr<ImagePropertyData> &img_prop) { Vec2D p = center_pos + this->sway_now; if (!this->isVisibleForWindowPos(center_pos, img_prop->img_size*img_prop->img_expansion)) return; SetDrawBright((int)(this->shield_ratio * 255), (int)(this->shield_ratio * 255), (int)(this->shield_ratio * 255)); DrawRotaGraph2((int)p.x, (int)p.y, img_prop->img_size.width / 2, img_prop->img_size.height / 2, img_prop->img_expansion, img_prop->img_rotation, graphHandle, true, img_prop->img_turn); }
//本編の文字表示 //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 OpeningScreen::FadeIn( void ) { for( int brightness = 0; brightness < 256; brightness += 15 ) { SetDrawBright( brightness, brightness, brightness ); ClearDrawScreen(); Draw(); ScreenFlip(); Sleep( 10 ); } }
void OpeningScreen::FadeOut( void ) { for( int brightness = 255; brightness >= 0; brightness -= 15 ) { SetDrawBright( brightness, brightness, brightness ); ClearDrawScreen(); Draw(); ScreenFlip(); Sleep( 10 ); } }
void Camera::drawImageInWorld(Vec2D center_pos, int graphHandle, const std::shared_ptr<ImagePropertyData> &img_prop) { Vec2D p = this->toWindowPosPxFromWorldPos(center_pos) + this->sway_now; double d = this->zoom_magnification_now*img_prop->img_expansion; double a = img_prop->img_rotation - this->rotate_angle_now; if (!this->isVisibleForWindowPos(p, img_prop->img_size*d, a)) return; SetDrawBright((int)(this->shield_ratio * 255), (int)(this->shield_ratio * 255), (int)(this->shield_ratio * 255)); DrawRotaGraph2((int)p.x, (int)p.y, img_prop->img_size.width / 2, img_prop->img_size.height / 2, d, a, graphHandle, true, img_prop->img_turn); }
//明るさ変更 void Bright::Update() { if (!changing) return; curBright += (newBright - oldBright) / time; if (count++ == time) { curBright = newBright; changing = false; } SetDrawBright(curBright, curBright, curBright); }
void Player::Draw_Dead() { if (elapsedTime % 4 >= 2) // 2fps毎に元の色に戻す { //SetDrawBlendMode(DX_BLENDMODE_INVSRC, 100); // On-Damage-Effect //SetDrawBright(255, 0, 0); //SetDrawBlendMode(DX_BLENDMODE_ADD, 255); //SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100); SetDrawBright(255, 0, 0); // 赤色に設定 } switch (keydir) { case InputDir::Left: DrawRotaGraph(pos.x, pos.y, 2.0, 0.0, hg[0], true); break; case InputDir::Neutral: DrawRotaGraph(pos.x, pos.y, 2.0, 0.0, hg[1], true); break; case InputDir::Right: DrawRotaGraph(pos.x, pos.y, 2.0, 0.0, hg[2], true); break; } SetDrawBright(255, 255, 255); // 元の色合い }
void graph_main(){ if(bright_set.brt!=255)SetDrawBright(bright_set.brt,bright_set.brt,bright_set.brt); graph_back_main();//背景描画メイン graph_effect(0);//敵が死ぬエフェクト if(bright_set.brt!=255)SetDrawBright(255,255,255); graph_effect(4);//喰らいボムのエフェクト if(bright_set.brt!=255)SetDrawBright(bright_set.brt,bright_set.brt,bright_set.brt); graph_boss(); graph_enemy();//敵の描画 graph_cshot();//自機ショットの描画 if(bright_set.brt!=255)SetDrawBright(255,255,255); graph_ch();//自機の描画 if(bright_set.brt!=255)SetDrawBright(bright_set.brt,bright_set.brt,bright_set.brt); graph_lazer();//レーザーの描画 graph_bullet();//弾の描画 if(bright_set.brt!=255)SetDrawBright(255,255,255); graph_effect(1);//ボムのエフェクト graph_effect(2);//ボム線のエフェクト graph_effect(3);//ボムキャラのエフェクト graph_board();//ボードの描画 graph_develop(); }
void Scene_DollUnite::DrawBonusTable(int _alpha) const{ // 一人目の人形が選択されている場合 if(pBaseParent == NULL) return; BYTE dollType = pBaseParent->GetType(); BYTE dollAttr = pBaseParent->GetAttr(); BYTE type = UNITEBONUS_TYPE_NONE; for(int j=0; j<UNITEBONUS_ATTR_NUM; j++){ for(int i=0; i<DOLL_ATTRSTONE_NUM; i++){ if(GetGettableBonus(pBaseParent->GetAttrStone(i), j)){ SetDrawBright(255,255,255); }else{ SetDrawBright(160,160,160); } DrawBonusCell( UNITEBONUS_CELL_INI_X + i * UNITEBONUS_CELL_WIDTH, UNITEBONUS_CELL_INI_Y + j * UNITEBONUS_CELL_HEIGHT, d_uniteBonus.GetUniteAttrBonus( dollType, dollAttr, i, j), _alpha); SetDrawBright(255,255,255); } } }
//ロゴ画面 void logo() { //パッド入力 int key = GetJoypadInputState(DX_INPUT_KEY_PAD1); SetDrawBright((int)light,(int)light,(int)light); DrawGraph(0,0,g_back,FALSE); timelogo++; // if(CheckHitKey(KEY_INPUT_RETURN) || CheckHitKey(KEY_INPUT_Z) || CheckHitKey(KEY_INPUT_X)) if(key&PAD_INPUT_A || key&PAD_INPUT_B || CheckHitKey(KEY_INPUT_RETURN)) { timelogo += 480; } if(timelogo >= 300) { light -= 4; if(light <= -240) { logoflag = true; light = 255; SetDrawBright((int)light,(int)light,(int)light); } } else { light += 2.5; if(light > 255) { light = 255; } } }
int Bright::ChangeBright(int bright, int time) { if (changing) return 0; if (time <= 0) { curBright = bright; SetDrawBright(curBright, curBright, curBright); return 1; } oldBright = curBright; newBright = bright; this->time = time; count = 0; if (newBright == oldBright) return 1; changing = true; return 0; }
void GameRoad::init(GameResult * result) { rd_g_res = result; cond = RO_INI; move_time = 0; time = 0; miss = 0; for(int i=0; i<3; i++) { get_rgb[i] = 0; } all_road = 0; head_x = RO_X_CNT; now_level = 0; del_block.ok = 0; del_block.type = 0; del_block.col = 0; block.ok = 0; block.type = 0; block.col = rand() % 3; once_btn = 0; ch_movetime = 4; ch_time = 4; ch_mode = 0; ch_walk = 0; alpha = 255; SetDrawBright( alpha , alpha , alpha ); SetFontSize(16); if(result == NULL) { s_col = 0; stage = 0; } else { s_col = result->stage_color(); stage = result->stage_level(); } efe_ok = 0; }
//タイトル表示 //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);//描画する画像の色光度を再設定 }
int intro(AI_T *ai){ AI_T *init_ai = ai; static int gametitle = LoadGraph("media\\chofu_fes2.bmp"); static int start=0; if(start==0){ start=1; // テンプレ // extern void !初期化関数名!(AI_T &myAi); // !初期化関数名!(ai[!aiの番号!]); // extern Action !移動関数名!(int view[2*VISIBLE+1][2*VISIBLE+1]); // init_ai->moveFunc = !移動関数名!; //!!![重要]!!!!一番初め(aiSample)以外、最初にinit_ai++;を書く!!!!!!!!!! //関数名などが被ると駄目です 名前は早い者勝ちで(基本自分のハンドルネーム) // Player extern void PlayerInit(AI_T &myAi); PlayerInit(*init_ai); extern Action Player(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc = Player; // Player // AI0 (aiSample) init_ai++; extern void aiSampleInit(AI_T &myAi); aiSampleInit(*init_ai); extern Action aiSample(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc = aiSample; // AI0 // AI1 (aiTest) init_ai++; extern void aiTestInit(AI_T &myAi); aiTestInit(*init_ai); extern Action aiTest(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc = aiTest; // AI1 //kuzumi init_ai++; extern void kuzumiInit(AI_T &myAi); kuzumiInit(*init_ai); extern Action kuzumi(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=kuzumi; // //AI_MsZero init_ai++; extern void AI_MsZeroInit(AI_T &myAi); AI_MsZeroInit(*init_ai); extern Action AI_MsZero(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=AI_MsZero; // init_ai++; extern void taoaiInit(AI_T &myAi); taoaiInit(*init_ai); extern Action taoai(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=taoai; init_ai++; extern void AINomeaningInit(AI_T &myAi); AINomeaningInit(*init_ai); extern Action AINomeaning(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=AINomeaning; init_ai++; extern void toshi_aiInit(AI_T &myAi); toshi_aiInit(*init_ai); extern Action toshi_ai(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=toshi_ai; init_ai++; extern void nununuInit(AI_T &myAi); nununuInit(*init_ai); extern Action nununu(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=nununu; init_ai++; extern void KenkinoInit(AI_T &myAi); KenkinoInit(*init_ai); extern Action Kenkino(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=Kenkino; init_ai++; extern void hotaInit(AI_T &myAi); hotaInit(*init_ai); extern Action hota(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=hota; //11 init_ai++; extern void hentekoInit(AI_T &myAi); hentekoInit(*init_ai); extern Action henteko(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=henteko; //12 init_ai++; extern void TsuuroInit(AI_T &myAi); TsuuroInit(*init_ai); extern Action Tsuuro(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=Tsuuro; /*AI追加欄 init_ai++; extern void AI名Init(AI_T &myAi); AI名Init(*init_ai); extern Action AI名(int view[2*VISIBLE+1][2*VISIBLE+1]); init_ai->moveFunc=AI名; */ } int entryX=320,entryY=315; int startX=320,startY=360; static int step=0,window=0,input=0,time=0,bright=255; int mx,my; int en=0; GetMousePoint(&mx,&my); time++; if(time>30)time=0; if(step==0){ if(GetMouseInput()==1){ step=1; } } if(step==1){ if(window<230)window+=23; if(GetMouseInput()==1 && input==0){ if(window>=230){ for(int i= 0; i < AI_NUM ;i++){ int x=20+201*(i%3),y=70+50*(int)(i/3); if(mx>=x && mx<=x+200 && my>=y && my<=y+50){ if(ai[i].entry==0)ai[i].entry=1; else ai[i].entry=0; } } if(mx>=30 && my>=400 && mx<=610 && my<=450){ step=2; window=0; } } } } if(step==2){ bright-=10; if(bright<=0){ SetDrawBright(255,255,255); return 1; } } for(int i=0;i<AI_NUM;i++){ if(ai[i].entry==1)en++; } if(GetMouseInput()==1 && input==0){ input=1; } if(GetMouseInput()==0 && input==1){ input=0; } ClearDrawScreen(); SetDrawBright(bright,bright,bright); DrawGraph(0,0,gametitle,FALSE); int cr=GetColor(125,255,205); if(step==0){ if(time%30<=15){ DrawString(240,350,"Click to start",cr,0); } } /* DrawString(entryX,entryY,"ENTRY AI",cr,0); DrawBox(entryX-80,entryY-20,entryX+80,entryY+20,cr,0); cr=GetColor(255,100,50); DrawString(startX,startY,"START!",cr,0); DrawBox(startX-100,startY-20,startX+100,startY+20,cr,0); */ if(step==1){ cr=GetColor(0,0,0); SetDrawBlendMode( DX_BLENDMODE_ALPHA,200); DrawBox(10,240-window,630,240+window,cr,1); SetDrawBlendMode( DX_BLENDMODE_ALPHA,255); cr=GetColor(255,255,255); DrawBox(10,240-window,630,240+window,cr,0); if(window>=230){ cr=GetColor(125,255,205); DrawString(240,30,"ENTRY AI",cr,0); cr=GetColor(255,255,255); for(int i= 0; i < AI_NUM ;i++){ if(ai[i].entry==0) SetDrawBright(100,100,100); int x=20+201*(i%3),y=70+50*(int)(i/3); DrawBox(x,y,x+200,y+50,cr,0); DrawBox(x,y,x+50,y+50,cr,0); DrawString(x+50,y+25,ai[i].name,GetColor(0,255,255),0); DrawRotaGraph(x+25,y+25,1,0,ai[i].Graph,FALSE,0); SetDrawBright(255,255,255); } cr=GetColor(255,100,50); DrawBox(30,400,610,450,cr,0); DrawString(240,425,"START!",cr,0); } } return 0; //WaitKey(); //WaitTimer(1000/60); }
void p11(void) { SetDrawScreen(DX_SCREEN_BACK); char keybuf[256]; int img; int bright = 0; bool isInc; img = LoadGraph("pic11.png"); isInc = true; while (ProcessMessage() == 0 && GetHitKeyStateAll(keybuf) == 0 && keybuf[KEY_INPUT_ESCAPE] == 0) { ClearDrawScreen(); SetDrawBright(255, 255, 255); DrawBox(5, 5, 205, 35, GetColor(255, 255, 255), TRUE); DrawGraph(210, 5, img, TRUE); SetDrawBright(255, 0, 0); DrawBox(5, 45, 205, 75, GetColor(255, 255, 255), TRUE); SetDrawBright(0, 255, 0); DrawBox(5, 85, 205, 115, GetColor(255, 255, 255), TRUE); DrawGraph(210, 125, img, TRUE); SetDrawBright(0, 0, 255); DrawBox(5, 125, 205, 155, GetColor(255, 255, 255), TRUE); SetDrawBright(0, 0, 0); DrawBox(5, 165, 205, 295, GetColor(255, 255, 255), TRUE); DrawGraph(210, 245, img, TRUE); SetDrawBright(128, 128, 128); DrawBox(5, 205, 205, 235, GetColor(255, 255, 255), TRUE); // おまけ for (int i = 0; i < 15; i++) { int temp = 255 - 140 + i * 10; SetDrawBright(temp, temp, temp); DrawBox(405 + i, 205 + i, 607 - i, 235 - i, GetColor(255, 255, 255), TRUE); } SetDrawBright(bright, bright, bright); DrawBox(5, 245, 205, 275, GetColor(255, 255, 255), TRUE); SetDrawBright(bright, 0, 0); DrawBox(5, 285, 205, 315, GetColor(255, 255, 255), TRUE); SetDrawBright(0, bright, 0); DrawBox(5, 325, 205, 355, GetColor(255, 255, 255), TRUE); SetDrawBright(0, 0, bright); DrawBox(5, 365, 205, 395, GetColor(255, 255, 255), TRUE); if (bright >= 255) { isInc = false; } if (bright <= 0) { isInc = true; } isInc ? bright += 1 : bright -= 1; ScreenFlip(); } }
void Enemy::Draw() { if (isExist) { // On-Damage-Effect if (MAX_HP / 3 >= hp && elapsedTime % 12 >= 10) { SetDrawBlendMode(DX_BLENDMODE_INVSRC, 255); SetDrawBright(255, 0, 0); } if (isDamage) SetDrawBlendMode(DX_BLENDMODE_INVSRC, 255); switch (type) { case 0: DrawRotaGraph(pos.x, pos.y, 2., angle, gh_ene00, true); break; case 1: break; case 2: DrawAnime(pos.x, pos.y, angle, elapsedTime, sizeof(gh_ene02) / sizeof(gh_ene02[0]), 2, gh_ene02); break; case 3: break; case 4: DrawAnime(pos.x, pos.y, 0.0, elapsedTime, sizeof(gh_ene04) / sizeof(gh_ene04[0]), 8, gh_ene04); if (s_time == stop_time || s_time == stop_time + 20 || s_time == stop_time + 40) { DrawRotaGraph(pos.x + 70, pos.y - 30, 2.0, 0.0, gh_shot00, true); DrawRotaGraph(pos.x + 50, pos.y, 2.0, 0.0, gh_shot00, true); DrawRotaGraph(pos.x - 70, pos.y - 30, 2.0, 0.0, gh_shot00, true); DrawRotaGraph(pos.x - 50, pos.y, 2.0, 0.0, gh_shot00, true); } break; case 5: break; case 6: break; case 7: break; } SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0); SetDrawBright(255, 255, 255); } shot->Draw(); if (shot2 != nullptr) shot2->Draw(); if (shot3 != nullptr) shot3->Draw(); // TEST if (!DebugMode::isTest) return; if (!isExist) return; // DrawFormatString(300, 300, GetColor(0, 255, 0), "%lf", angle); DrawCircle(pos.x, pos.y, hitRange, GetColor(0, 255, 0), false); }
Help::~Help(void) { SetDrawBright(255, 255, 255); }
void Piece::Draw_Piece(const int & i) { SetDrawBright(red[i], green[i], blue[i]); if(isSlow[i] == true && c_play[i]->Remainder(4) >= 2) { SetDrawBright(255, 255, 255); return; } switch (type) { case ePiece_SmallGray: for (int j = 0; j < sizeof(gh_small1) / sizeof(gh_small1[0]); j++) { if (c_play[i]->Remainder(16) == (j * 2) || c_play[i]->Remainder(16) == (j * 2) + 1) { DrawRotaGraph(pos[i].x, pos[i].y, 1.0, angle[i], gh_small1[j], true); break; } }break; case ePiece_SmallCoin: for (int j = 0; j < sizeof(gh_small6) / sizeof(gh_small6[0]); j++) { if (c_play[i]->Remainder(10) == (j * 2) || c_play[i]->Remainder(10) == (j * 2) + 1) { DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_small6[j], true); break; } }break; case ePiece_SmallSquare: for (int j = 0; j < sizeof(gh_small5) / sizeof(gh_small5[0]); j++) { if (c_play[i]->Remainder(8) == (j * 2) || c_play[i]->Remainder(8) == (j * 2) + 1) { DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_small5[j], true); break; } }break; case ePiece_Smalls: for (int j = 0; j < sizeof(gh_smalls) / sizeof(gh_smalls[0]); j++) { if (c_play[i]->Remainder(16) == (j * 2) || c_play[i]->Remainder(16) == (j * 2) + 1) { DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_smalls[ rand[i] ], true); break; } }break; case ePiece_BigNut: for (int j = 0; j < sizeof(gh_big1) / sizeof(gh_big1[0]); j++) { if (c_play[i]->Remainder(16) == (j * 2) || c_play[i]->Remainder(16) == (j * 2) + 1) { DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_big1[j], true); break; } }break; case ePiece_BigPlate: for (int j = 0; j < sizeof(gh_big2) / sizeof(gh_big2[0]); j++) { if (c_play[i]->Remainder(28) == (j * 2) || c_play[i]->Remainder(28) == (j * 2) + 1) { DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_big2[j], true); break; } }break; case ePiece_BigSquare: for (int j = 0; j < sizeof(gh_big3) / sizeof(gh_big3[0]); j++) { if (c_play[i]->Remainder(12) == (j * 2) || c_play[i]->Remainder(12) == (j * 2) + 1) { DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_big3[j], true); break; } }break; case ePiece_BigPlate3: for (int j = 0; j < sizeof(gh_big5) / sizeof(gh_big5[0]); j++) { if (c_play[i]->Remainder(28) == (j * 2) || c_play[i]->Remainder(28) == (j * 2) + 1) { DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_big5[j], true); break; } }break; case ePiece_Bigs: for (int j = 0; j < sizeof(gh_bigs) / sizeof(gh_bigs[0]); j++) { if (c_play[i]->Remainder(16) == (j * 2) || c_play[i]->Remainder(16) == (j * 2) + 1) { DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_bigs[ rand[i] ], true); break; } }break; case ePiece_Special: if( rand[i] >= 4) DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_kit, true); if (rand[i] <= 3) DrawRotaGraph(pos[i].x, pos[i].y, 2.0, angle[i], gh_burger, true); break; } SetDrawBright(255, 255, 255); }
void Image::draw2(int X,int Y,double zoom,int deg,int flip,int Brightness){ SetDrawBright(Brightness,Brightness,Brightness);//明るさを設定 DrawRotaGraph(X,Y,zoom,(double)(deg/180.0)*3.14,gh,1,flip); SetDrawBright(255,255,255);//明るさを元に戻す }
//DrawRotaGraph(); 回転やズームを利用 (倍率、角度)クラス内座標を使用 void Image::draw2(double zoom,int deg,int Brightness){ SetDrawBright(Brightness,Brightness,Brightness);//明るさを設定 DrawRotaGraph(x,y,zoom,(double)(deg/180.0)*3.14,gh,1,0); SetDrawBright(255,255,255);//明るさを元に戻す }
void Image::draw(int X,int Y,int Brightness){ SetDrawBright(Brightness,Brightness,Brightness);//明るさを設定 DrawGraph(X,Y,gh,1); SetDrawBright(255,255,255);//明るさを元に戻す }
void GameRoad::draw(void) { SPRITE *sp; int c = 0; if(cond == RO_INI) { return; } if(del_block.ok > 0) { SetDrawBlendMode( DX_BLENDMODE_INVSRC, 128); } // 背景 sp = &spd[RO_SP_BG]; DrawGraph(sp->x, sp->y, sp->num, TRUE); // 落ちるブロック描画 sp = &spd[cols[block.col]+block.type]; if(block.ok == 1) { DrawGraph(block.x, roady[block.k], sp->num, TRUE); } // 現在埋まっているブロックを描画 for(int i=0; i<RO_Y_CNT; i++) { for(int j=0; j<RO_X_CNT; j++) { int n = roads[i][j] & ~0xf0; int co = roads[i][j]>>4; if(n!=0) { sp = &spd[cols[co]+(n-1)]; DrawGraph(roadx[j], roady[i], sp->num, TRUE); } } } if(cond == RO_GAMEOVER) { // ゲームオーバー SetDrawBright( 255 , 255 , 255 ); for(int i=RO_SP_LOSE1; i<=RO_SP_LOSE4; i++) { sp = &spd[i]; DrawGraph(sp->x, sp->y, sp->num, TRUE); } SetDrawBright( alpha , alpha , alpha ); alpha -= 8; if(alpha < 128) { alpha = 128; } return; } // いち sp = &spd[RO_SP_ICHI]; DrawGraph(sp->x, sp->y, ichi_num[sp->pat][sp->num], TRUE); sp = &spd[RO_SP_FB]; DrawGraph(sp->x, sp->y, sp->num, TRUE); RO_LEVEL *lv = &levels[now_level]; // 現在レベル // 失敗ブロック描画 if(del_block.ok > 0) { del_block.ok -= 8; SetDrawBlendMode( DX_BLENDMODE_NOBLEND , 0); } if(del_block.ok <= 0) { del_block.ok = 0; } else { int n = del_block.type; sp = &spd[cols[del_block.col] + n]; SetDrawBlendMode( DX_BLENDMODE_ALPHA, del_block.ok ); //ブレンドモード DrawRotaGraph( del_block.x, roady[del_block.k], 1.0, 0.0, sp->num, TRUE ); // エフェクト描画 if(del_block.ok > 184) { sp = &spd[RO_SP_NG1]; } else { sp = &spd[RO_SP_NG2]; } DrawGraph(sp->x, sp->y, sp->num, TRUE); SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0 ); //ブレンドモードをオフ } if(efe_ok > 0) { int e = efe_ok / 8; if( e > 4 ) { efe_ok = 0; return; } sp = &spd[RO_SP_OK1+e]; DrawGraph(sp->x, sp->y, sp->num, TRUE); efe_ok++; } if(cond == RO_GAME_S) { if(stage == 0) { sp = &spd[RO_SP_T1]; } else { sp = &spd[RO_SP_T2]; } shine(sp); SetDrawBlendMode( DX_BLENDMODE_ALPHA, sp->pat); DrawGraph(sp->x, sp->y, sp->num, TRUE); SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0 ); } #ifdef _DEBUG // クリア描画 if(cond == RO_CLEAR) { if(stage == 0) { SetFontSize(24); DrawFormatString( 420 , 8 , GetColor( 0 , 0 , 0 ), "Ichi can walk! (←/↓/↑/→)"); SetFontSize(20); DrawFormatString( 100, 48, GetColor(0, 0, 0), "Let's cross to the opposite shore. Or let's fall from a bridge. " ); DrawFormatString( 100, 76, GetColor(0, 0, 0), "対岸へ渡りましょう。無理なら橋から落ちましょう。" ); } } else if(stage == 0) { DrawString(100, 48+8, "↑/↓:Panel up down", GetColor(0, 0, 0)); DrawString(100, 76+8, "←/→:Panel speed up or down", GetColor(0, 0, 0)); DrawString(100, 104+8,"Enter-key:panel is rotated.", GetColor(0, 0, 0)); DrawString(100, 132+8, "Let's connect a portion without a frame and construct a bridge. ", GetColor(0, 0, 0)); DrawString(100, 160+8, "流れる音のパネルを、左岸か他のパネルにつなげて道を作りましょう。", GetColor(0, 0, 0)); DrawString(100, 188+8, "枠の無い面でのみ、つなげられます。", GetColor(0, 0, 0)); } #else DrawFormatString( 0 , 0 , GetColor( 255, 255, 255 ) , "level:%d",now_level); #endif DrawFormatString( 12 , 32, GetColor(255 , 255 , 255 ) , "time:%d miss:%d",time, miss); DrawFormatString( 12 , 56, GetColor(255 , 0, 0), "red:%d", get_rgb[0]); DrawFormatString( 12 , 80, GetColor(0 , 255, 0),"green:%d", get_rgb[1]); DrawFormatString( 12 , 104, GetColor(0 , 0, 255),"blue:%d", get_rgb[2]); return; }
void draw(int stage[WIDTH][HEIGHT],AI_T ai[AI_NUM],Tagger tagger,Takara takara){ int view=0; if(CheckHitKey(KEY_INPUT_V))view=1;// 8/19 zero:Vキーを押していると描画モードが変わります。 static int stageGraph = LoadGraph("Stage_image\\kabe0.png"); //壁の画像読み込み //数列stageにしたがってマップの描画 for(int i=0;i<WIDTH;i++){ for(int j=0;j<HEIGHT;j++){ if(view==0)SetDrawBright(150,150,150);// 8/19 zero: 薄暗く描写するよう設定 for(int k=0;k<AI_NUM;k++){// 8/19 zero: AIの視界のみ明るくなるように if(i>=ai[k].x-VISIBLE && i<=ai[k].x+VISIBLE && j>=ai[k].y-VISIBLE && j<=ai[k].y+VISIBLE && ai[k].entry==1){ SetDrawBright(255,255,255); } } if(i==WIDTH/2 || j==HEIGHT/2){//7/27 zero: 十字回廊を描いてちょっとお洒落に DrawBox(20*i,20*j,20*(i+1),20*(j+1),GetColor(100,100,250),0); } if(stage[i][j]==1){//壁を仮に白い正方形としています。//土の壁にしました。 // DrawBox(20*i,20*j,20*(i+1),20*(j+1),GetColor(255,255,255),1);//四角の描写 DrawRotaGraph((20*i)+10,(20*j)+10,1.0,0.0,stageGraph,FALSE,FALSE);//読み込んだ壁画像表示 } if(stage[i][j]==4&&takara.drop==0){ DrawBox(20*i,20*j,20*(i+1),20*(j+1),GetColor(255,255,255),1);//宝の描写 } } } //AIの描画 for(int i=0;i<AI_NUM;i++){ if(ai[i].entry==1){ SetDrawBright(255,255,255); DrawRotaGraph(ai[i].s_x,ai[i].s_y,1,0,ai[i].Graph,TRUE,FALSE);//読み込んだ画像表示 //DrawCircle(ai[i].s_x,ai[i].s_y,5,GetColor(255,0,0),1);//点表示 if(view==1){ DrawBox(BOX*ai[i].x,BOX*ai[i].y,BOX*(ai[i].x+1),BOX*(ai[i].y+1),GetColor(255,0,0),0); DrawBox(BOX*(ai[i].x-VISIBLE),BOX*(ai[i].y-VISIBLE),BOX*(ai[i].x+VISIBLE+1),BOX*(ai[i].y+VISIBLE+1),GetColor(255,255,255),0);//AIの視界(確認用) } } } //鬼の描画 DrawRotaGraph(tagger.s_x,tagger.s_y,0.75,0,tagger.Graph,TRUE,FALSE);//読み込んだ画像表示 //今は青鬼が出てきて怖いからコメントアウト //DrawCircle(tagger.s_x,tagger.s_y,20,GetColor(0,0,255),1); if(view==1)DrawBox(BOX*tagger.x,BOX*tagger.y,BOX*(tagger.x+1),BOX*(tagger.y+1),GetColor(255,0,0),0); //AI名の描画 for(int i=0;i<AI_NUM;i++){ if(ai[i].entry==1){ static int flash=0; int cr; flash++; cr=GetColor(255,255*(flash%3),255*(flash%4)); DrawFormatString(ai[i].s_x,ai[i].s_y,cr,ai[i].name); } } //マップデータ表示 while(CheckHitKey(KEY_INPUT_P)==1){ int ai_x[AI_NUM],ai_y[AI_NUM],ai_num=0; DrawBox(0,0,640,480,GetColor(0,0,0),1); for(int i=0;i<WIDTH;i++){ for(int j=0;j<HEIGHT;j++){ int cr; switch(stage[i][j]){ case 1: cr=GetColor(100,50,0); break; case 2: cr=GetColor(255,0,0); ai_x[ai_num]=i; ai_y[ai_num]=j; ai_num++; break; case 3: cr=GetColor(0,0,100); break; default: cr=GetColor(0,0,0); break; } DrawBox(20*i,20*j,20*(i+1),20*(j+1),cr,1); cr=GetColor(255,255,255); //DrawBox(20*i,20*j,20*(i+1),20*(j+1),cr,0); DrawFormatString(i*20+5,j*20+5,cr,"%d",stage[i][j]); } } for(int i=0;i<AI_NUM;i++){ DrawBox(20*(ai_x[i]-10),20*(ai_y[i]-10),20*(ai_x[i]+10),20*(ai_y[i]+10),GetColor(255,255,0),0); } /* for(int i=0;i<AI_NUM;i++){ for(int w=0;w<2*VISIBLE+1;w++){ for(int h=0;h<2*VISIBLE+1;h++){ int cx=20*ai[i].x+(w-VISIBLE)*20,cy=20*ai[i].y+(h-VISIBLE)*20; DrawFormatString(cx,cy,GetColor(255,255,255),"%d",ai[i].view[w][h]); } } }*/ WaitTimer(100); } //鬼が手動か自動か表示 char Buf[ 256 ] ; GetHitKeyStateAll( Buf ) ; if( Buf[ KEY_INPUT_A ] == 1 ) { const char* str = strcat(tagger.name , "鬼手動モード"); //文字列連結 DrawString( 15, 15, str ,GetColor(255,0,255) ); }else { const char* str = strcat(tagger.name , "鬼AIモード"); //文字列連結 DrawString( 15, 15, str ,GetColor(255,0,255) ); } }