void BmsPlayer::drawInterface(unsigned long long time){ DrawFormatString(450, 60, GetColor(255, 255, 255), "GENRE : %s", parser->getHeader("GENRE").c_str()); DrawFormatString(450, 75, GetColor(255, 255, 255), "TITLE : %s", parser->getHeader("TITLE").c_str()); DrawFormatString(450, 90, GetColor(255, 255, 255), "ARTIST: %s", parser->getHeader("ARTIST").c_str()); DrawFormatString(450, 105, GetColor(255, 255, 255), "BPM : %s", parser->getHeader("BPM").c_str()); DrawFormatString(450, 120, GetColor(255, 255, 255), "TIME : %d", time); double visible_area; for (int j = 0; j <= 7; j++){ for (int note_num = visnote_begin.at(j); note_num < visnote_size.at(j); note_num++){ visible_area = ((double)visible_notes(j).at(note_num).second - time) / visible_time; // 範囲外 if (visible_area > 1){ break; } if (visible_area < 0) visnote_begin.at(j)++; // 範囲内 else{ // 描画 double y = ((double)visible_notes(j).at(note_num).second - time) / visible_time; system_graph.drawkey(j, 480 - (y * 480)); // y座標は LIFT - (y * SUD+), 0 <= x < 480 } } } }
void CTurn::SkipTurn(){ if(turn<10){ DrawFormatString(810,25,GetColor(255,255,255)," %d",turn); } if(turn>=10 && turn<100){ DrawFormatString(810,25,GetColor(255,255,255)," %d",turn); } if(turn>=100){ DrawFormatString(810,25,GetColor(255,255,255),"%d",turn); } skip=false; if(Event.key.GetDown(Event.key.RETURN)){ if(country==COUNTRY_NUM){ turn++; country=1; }else{ country++; } skip=true; } }
void Message::magic_attack(const char* chant_magic, cint magic_sound_handle) { this->window_box(); if (this->print_in_kanji) DrawFormatString(this->message_window.x + 5, this->message_window.y + 5, this->message_window.string_color, "%sは%sを唱えた!", this->attacker.c_str(), chant_magic); else DrawFormatString(this->message_window.x + 5, this->message_window.y + 5, this->message_window.string_color, "%sは%sをとなえた!", this->attacker.c_str(), chant_magic); ScreenFlip(); PlaySoundMem(magic_sound_handle, DX_PLAYTYPE_NORMAL); }
void draw_result() { DrawFormatString(0,0,0xffffff,"Bボタンでタイトルに戻る"); SetFontSize(40); DrawFormatString(Csystem::SCREEN_WIDTH/2 - 90,40,0xff5555,"敵撃破数%3d体",Csystem::destroy_enemy); SetFontSize(17); }
void Explosion::DrawTest() { // DrawGraph(0, 0, gh_explo[1], true); for (int i = 0; i < 3; i++) DrawFormatString(130, 20 + (i * 20), GetColor(0, 255, 0), "c[%d] = %d", i, c_play[i]->GetNowcount()); DrawFormatString(100, 100, GetColor(0, 255, 0), "speed[0].x = %lf", speed[0].x); DrawFormatString(100, 120, GetColor(0, 255, 0), "speed[0].x = %lf", speed[0].y); }
void CDraw::DrawNumber(int x,int y,int color,int num){ if(num>=100){ DrawFormatString(x,y,color,"%d",num); }else if(num>=10){ DrawFormatString(x,y,color," %d",num); }else{ DrawFormatString(x,y,color," %d",num); } }
// マップとプレイヤーの描画(クォータービューでない時) void Display::disp_map() { int MapDrawPointX , MapDrawPointY ; // 描画するマップ座標値 int DrawMapChipNumX , DrawMapChipNumY ; // 描画するマップチップの数 // 描画するマップチップの数(量)をセット DrawMapChipNumX = SCREEN_SIZE_X / ChipSizeX + 1 ; DrawMapChipNumY = SCREEN_SIZE_Y / ChipSizeY + 1 ; // 画面左上に描画するmap配列の番号をセット MapDrawPointX = player.chara_x - ((SCREEN_SIZE_X/2)/ChipSizeX); MapDrawPointY = player.chara_y - ((SCREEN_SIZE_Y/2)/ChipSizeY); // 描画 for(int j = MapDrawPointY; j < (MapDrawPointY + DrawMapChipNumY); j++) { for(int i = MapDrawPointX; i < (MapDrawPointX + DrawMapChipNumX); i++) { // 画面からはみ出た位置は描画しない if(i < 0 || j < 0 || i >= MAP_W || j >= MAP_H ) { continue; } // マップチップの描画 if(map[i][j] == ROOM || map[i][j] == PATH || map[i][j] == PATH_FRONT || map[i][j] == PATH_OF_WALL || map[i][j] == APPEND_PATH){ DrawGraph((i - MapDrawPointX)*ChipSizeX, (j - MapDrawPointY)*ChipSizeY, GraphHandle_Floorchip, TRUE); } // アイテムの描画 if(item_map[i][j] == ITEM){ DrawGraph((i - MapDrawPointX)*ChipSizeX, (j - MapDrawPointY)*ChipSizeY, GraphHandle_Item, TRUE); } // 残りアイテム数表示 int Color = GetColor(255, 255, 255); DrawFormatString(0, 0, Color, "残り:%d", LeftItemNum); DrawFormatString(0, 20, Color, "長さ:%d", Player_Length); } } // キャラクターだけ描画 for(int j = MapDrawPointY; j < (MapDrawPointY + DrawMapChipNumY); j++) { for(int i = MapDrawPointX; i < (MapDrawPointX + DrawMapChipNumX); i++) { // プレイヤーの描画 if(chara_map[i][j] == PLAYER){ DrawGraph((i - MapDrawPointX)*ChipSizeX, (j - MapDrawPointY)*ChipSizeY, GraphHandle_Player, TRUE); // しっぽの描画 if(Player_Length != 0){ tail_disp(i, j, MapDrawPointX, MapDrawPointY); } } } } WaitTimer(100); }
void BmsPlayer::bmsSoundTest(){ ChronoTimer timer, calcflame; FpsTimer fps; std::vector<int> i(1296, 0); while (ProcessMessage() == 0){ play_channel_sound(1, timer.GetLapTime()); for (int j = 11; j < 20; j++){ play_channel_sound(j, timer.GetLapTime()); } // TODO : play_channel_graph関数がめっちゃ重い //i.at(4) += play_channel_graph(4, i.at(4), timer.GetLapTime()); if (calcflame.GetLapTime() >= (1.0 / GetRefreshRate()) * 1000000){ DrawFormatString(0, 0, GetColor(255, 255, 255), "SoundTest"); DrawFormatString(0, 15, GetColor(255, 255, 255), "GENRE : %s", parser->getHeader("GENRE").c_str()); DrawFormatString(0, 30, GetColor(255, 255, 255), "TITLE : %s", parser->getHeader("TITLE").c_str()); DrawFormatString(0, 45, GetColor(255, 255, 255), "ARTIST: %s", parser->getHeader("ARTIST").c_str()); DrawFormatString(0, 60, GetColor(255, 255, 255), "BPM : %s", parser->getHeader("BPM").c_str()); DrawFormatString(0, 75, GetColor(255, 255, 255), "TIME : %d", timer.GetLapTime()); DrawFormatString(0, 90, GetColor(255, 255, 255), "内部FPS : %d", fps.GetLapTime()); DrawFormatString(0, 120, GetColor(255, 255, 255), "解像度 : %d(us)", fps.GetDiff()); DrawFormatString(0, 135, GetColor(255, 255, 255), "RefLate : %d", GetRefreshRate()); ScreenFlip(); ClearDrawScreen(); calcflame.ResetTime(); fps.ResetTime(); } } InitSoundMem(); }
// 会話などを表示する,UseBeforeZが1の場合 static int DrawBattleMessage(int Start, int End, StringScript_t MenuString[], int Damage, int EnemyName, int UseBeforeZ){ if(End<NowNumber+Start+UseBeforeZ){ NowNumber=0;return 1; } for( int i=Start; i<(NowNumber+Start+UseBeforeZ); i++){ if( i==5 || i==0)DrawFormatString(MenuString[i].x,MenuString[i].y,MenuString[i].color,MenuString[i].hyoji,Enemy[EnemyName].Name); else DrawFormatString(MenuString[i].x,MenuString[i].y,MenuString[i].color,MenuString[i].hyoji,Damage); DrawFormatString(0,200+(i*20),GetRainbowColor(),"%d",i); } DrawFormatString(40,200,GetRainbowColor(),"%d",NowNumber); if(CheckHitKey2(KEY_INPUT_Z)==1)NowNumber++; return 0; }
void Subweponbox::Draw(){ int height = 16; int color = GetColor(255,255,255); DrawFormatString(0, 0,color,"Equipments:[slot1:[%d], slot2:[%d]]",mEqipment[0],mEqipment[1]); DrawFormatString(0,height,color,"Have Subwepons"); for(int i=0;i<MaxBox;i++){ DrawFormatString(0,(i*height)+30,color, "SW[%d]:[Name:%s, Damage:%d]", i, mSubwepon[i].GetStatus().Name.c_str(), mSubwepon[i].GetStatus().Damage ); } }
void text(int *flag){ static int font; if (*flag == 0){ font = CreateFontToHandle(NULL, 64, 5, DX_FONTTYPE_NORMAL); *flag = 1; } ChangeFont("MS 明朝"); SetMainWindowText("タイトル"); DrawFormatString(20, 430, 0xffffff, "2キーで2人プレイ、3キーで3人プレイ、4キーで4人プレイ、"); DrawFormatString(20, 450, 0xffffff, "Cキーでギャラリー画面へ"); DrawStringToHandle(150, 240 - 42, "神 経 衰 弱", GetColor(255, 100, 50), font); }
void drawScene() { /* tiny3d_Project3D(); tiny3d_SetProjectionMatrix(NULL); DrawBackground3D(0xffff00ff) ; // yellow */ tiny3d_Project2D(); // change to 2D context (remember you it works with 848 x 512 as virtual coordinates) // fix Perspective Projection Matrix DrawBackground2D(0x0040ffff) ; // light blue SetFontSize(16, 24); SetFontColor(0xffffffff, 0x0); SetFontAutoCenter(1); DrawString(0, (512 - 24)/2 - 64, "Use LEFT/RIGHT/UP/DOWN to adjust the screen"); DrawFormatString(0, (512 - 24)/2, "Video Scale X: %i Y: %i", videoscale_x, videoscale_y); DrawString(0, (512 - 24)/2 + 64, "Press 'X' to exit"); SetFontAutoCenter(0); }
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); } } } }
void Menu::Draw() { title->Draw(); // タイトル if ( !title->isStop ) return; // タイトルが止まってないならスルー graphic->DrawMyString2(X, y[0], "START", SPACE, true, 2.0); graphic->DrawMyString2(X, y[1], "CONTINUE", SPACE, true, 2.0); graphic->DrawMyString2(X, y[2], "CONFIG", SPACE, true, 2.0); graphic->DrawMyString2(X, y[3], "QUIT", SPACE, false, 2.0); // その他の情報 graphic->DrawMyString2(140, 440, "SINCE 2015 SHOPPE YAHU!", SPACE, true, 2.0); DrawRotaGraph(320, 466, 2.0, 0.0, h_twi, true); // ツイッター DrawRotaGraph(X_CUR, y_cur, 2.0, 0.0, h_cursor, true); // カーソル score->Draw(); // スコア表示 if (isGame) { DrawBox(0, 0, 640, 480, GetColor(0, 0, 0), TRUE); graphic->DrawMyString2(60, 180, "STANDBY READY?", 40, false, 4.0); graphic->DrawMyString2(140, 260, "GOOD LUCK!", 40, false, 4.0); } // TEST if (!DebugMode::isTest) return; DrawFormatString(0, 50, GetColor(0, 255, 0), "ano_tri = %d", ano_tri); }
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){ ChangeWindowMode(TRUE), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK ); //ウィンドウモード変更と初期化と裏画面設定 SetGraphMode(512,512,16) ;//ディスプレイの大きさの設定 SceneMgr sceneMgr; sceneMgr.Initialize(); while( ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && gpUpdateKey()==0 ){ sceneMgr.Update(); //更新 sceneMgr.Draw(); //描画 fps(); if(Keyboard_Get(KEY_INPUT_F1) == 1){ debbattle = !debbattle; } if(debbattle){ DrawFormatString(0, 10,GetColor(255,255,255),"battle:true"); } fpsc++; } sceneMgr.Finalize(); DxLib_End(); // DXライブラリ終了処理 return 0; }
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){ SetWindowText("Title"); SetGraphMode(WINDOW_WIDTH , WINDOW_HEIGHT,32 ); ChangeWindowMode(TRUE), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK ); int LoadImage = LoadGraph("Natsuiro/BLOCK/load.png"); DrawExtendGraph(0,0,WINDOW_WIDTH,WINDOW_HEIGHT, LoadImage ,false); ScreenFlip(); SetTransColor(255,0,255); Awake(); long long TIME = GetNowHiPerformanceCount(); # if BENCHMARK == TRUE long long int count = GetNowCount(); # endif while( ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && !CheckHitKey(KEY_INPUT_ESCAPE) ){ GameLoop(); Sleep( (unsigned long)max( 16 - (int)( GetNowHiPerformanceCount() - TIME ) / 1000 , 0 ) ); TIME = GetNowHiPerformanceCount(); # if BENCHMARK == TRUE DrawFormatString(WINDOW_WIDTH-200,0,BLACK,"FPS %d (%dms)", (int)( 1000/( GetNowCount() - count ) ) , GetNowCount() - count ); count = GetNowCount(); # endif } DxLib_End(); return 0; }
void Effect_FadeString::Draw(void){ SetDrawBlendMode(DX_BLENDMODE_ALPHA,(int)(numAlpha + 0.5)); SetFontSize(fontSize); DrawFormatString((int)(this->X() + 0.5) , (int)(this->Y() + this->hight + 0.5) , this->Texture() , drawStr.c_str()); SetFontSize(16); SetDrawBlendMode(DX_BLENDMODE_NOBLEND,0); }
void drawScene() { float x, y; tiny3d_Project2D(); // change to 2D context (remember you it works with 848 x 512 as virtual coordinates) DrawBackground2D(0x0040ffff) ; // light blue SetFontSize(12, 24); x= 0.0; y = 0.0; SetCurrentFont(1); SetFontColor(0xffffffff, 0x0); x = DrawString(x,y, "Hello World!. My nick is "); SetFontColor(0x00ff00ff, 0x0); SetCurrentFont(0); x = DrawString(x,y, "Hermes "); SetCurrentFont(1); SetFontColor(0xffffffff, 0x0); x = DrawString(x,y, "and this is one sample working with\nfonts."); SetCurrentFont(2); x= 0; y += 64; SetCurrentFont(1); DrawString(x, y, "I am using 3 fonts:"); SetCurrentFont(0); y += 64; SetFontColor(0xffffffff, 0x00a000ff); DrawString(x, y, "Font 0 is one array of 224 chars 16 x 32 pix and 2 bit depth"); SetCurrentFont(1); y += 64; SetFontColor(0xffffffff, 0xa00000ff); DrawString(x, y, "Font 1 is one array of 224 chars 16 x 32 pix and 2 bit depth"); SetCurrentFont(2); y += 64; SetFontColor(0x000000ff, 0xffff00ff); DrawString(x, y, "Font 2 is one array of 255 chars 8 x 8 pix and 1 bit depth"); y += 64; SetCurrentFont(1); SetFontSize(32, 64); SetFontColor(0xffffffff, 0x000000ff); SetFontAutoCenter(1); DrawString(0, y, "You can resize letters"); SetFontAutoCenter(0); SetFontSize(12, 24); SetFontColor(0xffffffff, 0x00000000); y += 72; DrawString(0, y, "change the color, background color and center the text\nwith SetFontAutoCenter()"); y += 72; SetFontColor(0x00ff00ff, 0x00000000); DrawFormatString(0, y, "Here %s font 0 uses %i bytes as texture", "using DrawFormatString()", 224*(16*2/8)*32); }
void draw(){ DrawFormatString(0, 0, 0xffffff, "タイトル"); for (const auto button : buttons.getLocal()) { button.second.draw().drawText(0); } }
// 感謝! void Display::Thanks() { int Color = GetColor(255, 255, 255); //ClearDrawScreen(); SetFontSize(30); DrawFormatString(155, 200, Color, "Thank you for playing!"); //ScreenFlip(); }
void CommandButton::Draw(){ int StringWidth; SetFontSize( FontSize ); //StringWidth = GetDrawFormatStringWidth( "%s" , Caption ); DrawBox( Left , Top , Left + Width , Top + Height , BGColor , TRUE ); DrawFormatString( Left + ((Width - StringWidth)/2) , Top + ((Height - FontSize)/2) , ForeColor , "%s" , Caption ); }
void KeyConfig::Draw() { config.Draw(&config); exit.Draw(&exit); if (flag) { DrawFormatString(200, 440, Black, "ESCキー以外を設定することができます、ESCキーで設定中断"); if (first == -1) { DrawFormatString(200, 460, Black, "変更したいキーの一つ目を入力してください..."); } else { DrawFormatString(200, 460, Black, "変更したいキーの二つ目を入力してください..."); } } DrawString(200, 70, "役割 |現在の割り振り |デフォルト", Black); for (int i = 0; i < settingkey; ++i) { DrawFormatString(200, 100 + i * 25, Black, "%10s: %15s: %10s", keyinfo[i].c_str(), keyname[i].c_str(), keydef[i].c_str()); } }
void Game::Draw() { //mino->Draw(); field->Draw(); // TEST DrawFormatString(0, 20, GetColor(0, 255, 0), "GAME_SCENE_NOW"); }
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 fps(){ int i; static int t = 0, ave = 0, f[60]; f[count % 60] = GetNowCount() - t; t = GetNowCount(); if (count % 60 == 59){ ave = 0; for (i = 0; i<60; i++) ave += f[i]; ave /= 60; } if (ave != 0){ DrawFormatString(0, 0, GetColor(255, 255, 255), "%.1fFPS", 1000.0 / (double)ave); DrawFormatString(0, 20, GetColor(255, 255, 255), "%dms", ave); } return; }
//描画 void Game::Draw(){ extern int cell; if(!battlemode){ stageMgr.Draw(players[nowplayer].getPlayerx(),players[nowplayer].getPlayery()); players[nowplayer].Draw(); menu.Draw(); } else{ battle.Draw(); } if(dead){ stageMgr.Draw(players[nowplayer].getPlayerx(),players[nowplayer].getPlayery()); DrawGraph(cell*7+cell/2,cell*7+cell/2,src2,TRUE); DrawGraph(0,342,src1,TRUE); DrawFormatString(40,382,white,"この みじゅくもの!"); DrawFormatString(40,400,white,"ぜいいん、しんでしまうとは・・・"); DrawFormatString(40,418,white,"もういちど でなおしてこい!"); } }
void draw(Graph graph[15]){ static int i; for (i = 0; i < 15; i++){ DrawExtendGraph(graph[i].x, graph[i].y, graph[i].x + graph[i].width, graph[i].y + graph[i].height, graph[i].handle, TRUE); } DrawFormatString(20, 450, 0xff0000, "クリックで拡大。'x'でタイトルに戻る"); mouse(graph); }
void Clear_Draw() { DrawRotaGraph(WIDTH/2, HEIGHT/2,1.0,0, clear_image,true, 0); DrawFormatStringToHandle(250, 360, GetColor(255,127,39), CScoreFont, "ヒキョリ: %6d km", score); for (int i = 0; i < 3; i++) { DrawGraph(Menu_clear[i].x + 42 - 76, Menu_clear[i].y + 9 - 27, Menu_clear[i].image, true); DrawFormatString(Menu_clear[i].x, Menu_clear[i].y, Menu_clear[i].color, Menu_clear[i].name); } }
void ObjectStatus::showStatus(int x, int y) const{ DrawFormatString(x, y+ 0, GetColor(255,255,255), "id %d", id); DrawFormatString(x, y+16, GetColor(255,255,255), "hp %d/%d", hp, maxhp); DrawFormatString(x, y+32, GetColor(255,255,255), "mp %d/%d", mp, maxmp); DrawFormatString(x, y+48, GetColor(255,255,255), "str %d", str); DrawFormatString(x, y+64, GetColor(255,255,255), "def %d", def); DrawFormatString(x, y+80, GetColor(255,255,255), "agi %d", agi); DrawFormatString(x, y+94, GetColor(255,255,255), "mob %d", mobility); }
s32 main(s32 argc, const char* argv[]) { ya2d_init(); ya2d_Texture *texture1 = ya2d_loadPNGfromBuffer((void *)pngsample_png, pngsample_png_size); ya2d_Texture *texture2 = ya2d_loadPNGfromBuffer((void *)alphaimg_png, alphaimg_png_size); int x = 50, y = 100; int size = 50; float angle = 0.0f; while(1) { ya2d_screenClear(); ya2d_screenBeginDrawing(); ya2d_controlsRead(); DrawFormatString(15, 15, "YA2D LIB -- by xerpi, thanks to deaphroat, harryoke and Veritassdg for testing ;)"); DrawFormatString(15, 35, "FPS: %.2f available vram: %i largest block: %i", ya2d_screenFPS(), vmemavail(), vlargestblock()); DrawFormatString(15, 55, "Press START to exit."); if(ya2d_paddata[0].BTN_RIGHT) x+=10; if(ya2d_paddata[0].BTN_LEFT) x-=10; if(ya2d_paddata[0].BTN_DOWN) y+=10; if(ya2d_paddata[0].BTN_UP) y-=10; if(ya2d_paddata[0].BTN_CROSS) ya2d_drawFillRect(200, 350, 100, 100, rand()); if(x > (SCREEN_W-size)) x = SCREEN_W-size; if(x<0) x = 0; if(y > (SCREEN_H-size)) y = SCREEN_H-size; if(y<0) y = 0; ya2d_drawFillRect(x, y, size, size, 0xFF0000FF); ya2d_drawRotateTexture(texture2, 50, 90, angle += 0.1f); ya2d_drawTexture(texture1, 100, 50); ya2d_screenFlip(); if(ya2d_paddata[0].BTN_START) break; } ya2d_freeTexture(texture1); ya2d_freeTexture(texture2); ya2d_deinit(); return 0; }