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 begin(menu& m) { ClearDrawScreen(); const unsigned int x=0; const unsigned int y=195; const unsigned int Green=GetColor(0,255,0); unsigned int counter=0; m.load_max_v(); DrawFormatString(520,450,GetColor(255,255,255),"Loading ..."); for(unsigned int count_down=3; !ScreenFlip()&&!ProcessMessage()&&!ClearDrawScreen()&&count_down>0; --count_down){ m.effectiving(); DrawStringToHandle(x+260,y,boost::lexical_cast<std::string>(count_down).c_str(), Green,m.font_Handle[1]); std::this_thread::sleep_for(std::chrono::seconds(1)); } std::this_thread::sleep_for(std::chrono::seconds(1)); std::chrono::system_clock::time_point start=std::chrono::system_clock::now(); while(!ScreenFlip()&&!ProcessMessage()&&!ClearDrawScreen()){ m.effectiving(); DrawStringToHandle(x+100,y,"残り",Green,m.font_Handle[0]); DrawStringToHandle(x+235,y,boost::lexical_cast<std::string>(m.max_v-counter).c_str(), Green,m.font_Handle[1]); DrawStringToHandle(x,0, (std::string("回数: ")+=boost::lexical_cast<std::string>(m.max_v)).c_str(), Green,m.font_Handle[2]); DrawStringToHandle(x,45, (std::string("現在: ")+=boost::lexical_cast<std::string>(counter)).c_str(), Green,m.font_Handle[2]); DrawStringToHandle(x,90, (std::string("時間: ")+=boost::lexical_cast<std::string>( std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()-start).count() )).c_str(), Green,m.font_Handle[2]); DrawStringToHandle(x,135,"Q: 中止",Green,m.font_Handle[2]); count(counter); if(counter==m.max_v)break; if(CheckHitKey(KEY_INPUT_Q))break; } Rank(std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now()-start),m); }
void p12(void) { SetDrawScreen(DX_SCREEN_BACK); int i; char keybuf[256]; int img; i = 0; img = LoadGraph("pic11.png"); while (ProcessMessage() == 0 && GetHitKeyStateAll(keybuf) == 0 && keybuf[KEY_INPUT_ESCAPE] == 0) { ClearDrawScreen(); DrawRotaGraph(120, 239, 1.0, PI / 4.0, img, TRUE); DrawCircle(120, 239, 5, GetColor(255, 0, 0), TRUE); DrawRotaGraph(320, 239, 1.0, PI / 180.0 * i, img, TRUE); DrawCircle(320, 239, 5, GetColor(255, 0, 0), TRUE); DrawRotaGraph2(520, 239, 19, 19, 1.0, PI / 180.0 * i * 2, img, TRUE); DrawCircle(520, 239, 5, GetColor(255, 0, 0), TRUE); ScreenFlip(); i++; } }
int Draw(Screen *screen){// メイン描画処理 ClsDrawScreen(); //printfDx("テスト1\n"); DrawScene(screen);//ステージを描画させる ScreenFlip(); return DRAW_SUCCESS; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { system_init(); if (DxLib_Init() == -1 || SetDrawScreen(DX_SCREEN_BACK) != 0)return -1; // 初期化と裏画面化 game_init(); LogSP log1 = LogSP(new Log("あいうえお")); LogSP log2 = LogSP(new Log("かきくけこ")); LogSP log3 = LogSP(new Log("さしすせそ")); manager.push(log1); manager.push(log2); manager.push(log3); while (ProcessLoop()) { mso::KeyBoard::SetNowState(); manager.process(); mso::FpsController::Wait(); mso::FpsController::Draw(); ScreenFlip(); // 裏画面反映 mso::KeyBoard::KeepPrevState(); } DxLib_End(); return 0; }
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(); }
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){ ChangeWindowMode(TRUE);//ウィンドウモード if(DxLib_Init() == -1 || SetDrawScreen( DX_SCREEN_BACK )!=0) return -1;//初期化と裏画面化 while(ProcessLoop()==0){//メインループ switch(func_state){ case 0://初回のみ入る処理 load(); //データロード first_ini();//初回の初期化 func_state=99; break; case 99://STGを始める前に行う初期化 ini(); func_state=100; break; case 100://通常処理 calc_ch(); //キャラクタ計算 ch_move(); //キャラクタの移動制御 enemy_main();//敵処理メイン graph_main();//描画メイン stage_count++; break; default: printfDx("不明なfunc_state\n"); break; } if(CheckStateKey(KEY_INPUT_ESCAPE)==1)break;//エスケープが入力されたらブレイク ScreenFlip();//裏画面反映 } DxLib_End();//DXライブラリ終了処理 return 0; }
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { ChangeWindowMode(TRUE); DxLib_Init(); SetDrawScreen(DX_SCREEN_BACK); Normal_Ball normalBall(3,4); Normal_Bar normalBar(5); normalBall.initialize(); normalBar.initialize(); while (!ProcessMessage() && !ScreenFlip() && !ClearDrawScreen()) { KeyboardInput::Instance()->update(); if (KeyboardInput::Instance()->get(KEY_INPUT_ESCAPE) == 1){ break; } normalBall.update(); normalBar.update(); normalBall.draw(); normalBar.draw(); } normalBall.finalize(); normalBar.finalize(); DxLib_End(); return 0; }
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){ // DXライブラリ初期化 ChangeWindowMode( TRUE ) ; if(DxLib_Init() == -1 ) { return -1; } CShootingScene CShootingScene; SetDrawScreen( DX_SCREEN_BACK ) ; while(1) { ClearDrawScreen(); CShootingScene.DrawImage(); ScreenFlip(); if( ProcessMessage() < 0 ) break ; #ifdef _DEBUG if( CheckHitKey( KEY_INPUT_ESCAPE ) ) break ; #endif } // DXライブラリ終了処理 DxLib_End(); return 0; }
// -------------------------------------------------------------------- // プレイヤー、敵、弾、背景の描画処理を呼ぶ // -------------------------------------------------------------------- void DrawGame() { // 画面を初期化 ClearDrawScreen(); // 描画先画面を裏にする SetDrawScreen( DX_SCREEN_BACK ); // 背景描画 DrawBG(); // プレイヤーの描画処理 DrawObject(Player); // プレイヤーの弾描画 DrawObject(PlayerShot); // 敵の描画 DrawObject(Enemy); // 敵の弾描画 DrawObject(EnemyShot); // 裏画面に描いたものを表画面に反映する ScreenFlip(); return; }
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 sort(int bl[],int x){ int tmp;//一時 int cmp=0,swp=0;//比較、交換 int i, j;//ループ用 for(i=0;i<x;i++){//x=20 for(j=0;j<(x-1)-i;j++){ SetDrawScreen(DX_SCREEN_BACK); // 描画先を裏画面へ ClsDrawScreen(); //裏画面消去 cmp++;//比較+1 if(bl[j]>bl[j+1]){ swp++;//交換+1 tmp =bl[j]; bl[j]=bl[j+1]; bl[j+1]=tmp; } showHeader(cmp, swp);//ヘッダー表示 showGraph(bl, ARRAY_SIZE, j);//表示 //_sleep(10); ScreenFlip(); // 裏画面を表画面へ } } /////////////////////////////////////////////// }
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 WriteNobelString(char* str){ int line=0; int defx=60; int defy=360; for(int i=0; str[i]!='\0' && CheckHitKey(KEY_INPUT_LCONTROL)==0 ; i++){ ClearDrawScreen(); DrawGraph(0,0,graph::back[0],true); DrawCharaGraph(chara_num); DrawGraph(0,0,graph::textbox,true); //DrawTextBox(); if(i!=0 && i%MSG_MAX_LEN==0){ line+=1; } for(int n=0; n<MSG_MAX_LINE; n++){ if(n==line){ WriteString(str, n*MSG_MAX_LEN, i-n*MSG_MAX_LEN, defx, defy+20*n, n); break; } else { WriteString(str, n*MSG_MAX_LEN, MSG_MAX_LEN, defx, defy+20*n, n); } } Sleep(1); ScreenFlip(); } while(ProcessMessage()==0 && (CheckHitKey(KEY_INPUT_Z)==0 && CheckHitKey(KEY_INPUT_LCONTROL)==0) ){ } }
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ){ ChangeWindowMode(TRUE); gFPS.SetDefaultFPS(60); if( DxLib_Init() == -1 ){ return -1; // エラーが起きたら直ちに終了 } ChangeFontType(DX_FONTTYPE_ANTIALIASING_EDGE); SetMouseDispFlag(TRUE); gameManager.SetStage(gameManager.Load); for(;;){ //メインループ ClearDrawScreen(); if(ProcessMessage()==-1 || GameMain()==1){break;} //ゲーム本体を実行 //FPS描画 int NowFPS = gFPS.Get(); int Col = (int)(255 * NowFPS / gFPS.GetDefaultFPS()); //DrawFormatString(500,450,GetColor(255,Col,Col),"FPS: %d",NowFPS); ScreenFlip(); if((GetJoypadInputState( DX_INPUT_KEY_PAD1 ) & PAD_INPUT_10) !=0){ GetDateTime( &Date ); std::stringstream fname; fname <<"img" << Date.Year << Date.Mon << Date.Day <<Date.Hour <<Date.Min <<GetNowCount() << ".png"; SaveDrawScreenToPNG( 0 , 0 , 480 , 480 ,fname.str().c_str()) ; } gFPS.Fix(); } DxLib_End() ; // DXライブラリ使用の終了処理 return 0 ; // ソフトの終了 }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { Application app; ChangeWindowMode(TRUE), SetGraphMode(Application::m_windowWidth,Application::m_windowHeight, 32); SetDrawScreen(DX_SCREEN_BACK); if (DxLib_Init() == -1) // DXライブラリ初期化処理 { return -1; } //CreateConsoleWindow(); while (ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0) { app.AppMain(); } DxLib_End(); CloseConsoleWindow(); return 0; // ソフトの終了 }
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, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow ){ ChangeWindowMode(TRUE);//ウィンドウモード if(DxLib_Init() == -1 || SetDrawScreen( DX_SCREEN_BACK )!=0) return -1;//初期化と裏画面化 int Menu = 1; load(); ini(); while(ProcessMessage()==0 && ClearDrawScreen()==0 && gpUpdateKey(Key)==0 && Key[KEY_INPUT_ESCAPE]==0){ //↑メッセージ処理 ↑画面をクリア ↑入力状態を保存 ↑ESCが押されていない if(Key[ KEY_INPUT_SPACE ]==1 || Key[ KEY_INPUT_RETURN ]==1) Menu = 2; switch(Menu){ case 1:back_graph();break; case 2:main_graph();break; } ScreenFlip();//裏画面反映関数 } DxLib_End();//DXライブラリ終了処理 return 0; }
BaseScene* BaseScene::main(){ if(running) return nullptr; //1度に実行できるシーンは1つ running = true; next_scene = nullptr; //ループ前処理 initialize(); looping = true; //メインループ while(looping){ if(processLoop()){ running = false; return nullptr; } update(); draw(); ScreenFlip(); //裏画面を表画面に反映 } //ループ後処理 finalize(); running = false; return next_scene; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow) { ChangeWindowMode(TRUE); SetGraphMode(WINDOW_X, WINDOW_Y, 32); if (DxLib_Init() == -1)return -1; SetDrawScreen(DX_SCREEN_BACK); //�錾 GameManager *gm = new GameManager(WINDOW_X, WINDOW_Y); while (ProcessMessage() != -1) { int startTime = GetNowCount(); ScreenFlip(); ClearDrawScreen(); //���� gm->All(); if (CheckHitKey(KEY_INPUT_ESCAPE) == 1)break; int endTime = GetNowCount(); WaitTimer((1000 / 60) - (endTime - startTime)); } delete gm; DxLib_End(); return 0; }
BmsPlayer::BmsPlayer(std::string bms_path){ sound_handle.resize(1296); graph_handle.resize(1296); visnote_begin.resize(8); visnote_next.resize(8); visnote_size.resize(8); notes.resize(8); before_graph_index = -1; data_out_range = std::make_pair(0, 0); index_count.resize(1296); visible_time = 500000; //debug combo_debug = 0; // parse parser = new BmsParser(bms_path); parser->parseBms(); channel_array = parser->getInfoAllChannel(); // note infomation for (int i = 0; i <= 7; i++){ visnote_size.at(i) = visible_notes(i).size(); } ScreenFlip(); ClearDrawScreen(); }
void p9(void) { SetDrawScreen(DX_SCREEN_BACK); char keybuf[256]; while (ProcessMessage() == 0 && GetHitKeyStateAll(keybuf) == 0 && keybuf[KEY_INPUT_ESCAPE] == 0) { ClearDrawScreen(); DrawLine(10, 10, 200, 10, GetColor(255, 0, 0)); DrawLine(10, 20, 200, 20, GetColor(0, 255, 0)); DrawLine(10, 30, 200, 30, GetColor(0, 0, 255)); SetDrawBlendMode(DX_BLENDMODE_ALPHA, 100); // αブレンド DrawBox(5, 5, 205, 35, GetColor(255, 255, 255), TRUE); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, TRUE); // ブレンドなし DrawBox(100, 100, 201, 201, GetColor(255, 0, 0), TRUE); SetDrawBlendMode(DX_BLENDMODE_ADD, 255); // 加算ブレンド DrawCircle(150, 150, 50, GetColor(0, 255, 255), TRUE); SetDrawBlendMode(DX_BLENDMODE_SUB, 255); // 減算ブレンド DrawCircle(150, 150, 30, GetColor(0, 100, 100), TRUE); SetDrawBlendMode(DX_BLENDMODE_INVSRC, 255); // 反転ブレンド DrawOval(300, 200, 30, 25, GetColor(0, 0, 0), TRUE); SetDrawBlendMode(DX_BLENDMODE_MULA, 255); // 乗算ブレンド DrawOval(300, 200, 25, 30, GetColor(0, 100, 100), TRUE); SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255); DrawPixel(320, 240, GetColor(255, 255, 255)); DrawTriangle(5, 5, 205, 5, 5, 35, GetColor(0, 0, 0), TRUE); DrawTriangle(5, 5, 205, 5, 5, 35, GetColor(255, 255, 255), FALSE); ScreenFlip(); } }
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { ShowConsole(); ChangeWindowMode(true); SetGraphMode(288, 512, 32); SetDrawScreen(DX_SCREEN_BACK); if (DxLib_Init() == -1) { printf("DxLib起動失敗!!"); return -1; } m_pSceneManager = new SceneManager(key); m_pSceneManager->load(); m_pSceneManager->init(); while (ScreenFlip() == 0 && ProcessMessage() == 0 && getupKey() == 0) { ClearDrawScreen(); m_pSceneManager->updata(); if (key[KEY_INPUT_ESCAPE] == 1)break; } delete m_pSceneManager; return DxLib_End(); }
// プログラムは WinMain から始まります int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { GameScene* mGameScene; //ゲームシーンの作成 こいつが画面を見ている mGameScene = new GameScene; //インスタンス生成 GameSceneのコンストラクタでタイトルシーンをを入れている SetGraphMode(640, 480, 16); //画面の解像度 ChangeWindowMode(TRUE); if (DxLib_Init() == -1) // DXライブラリ初期化処理 { return -1; // エラーが起きたら直ちに終了 } // 描画先画面を裏画面にセット SetDrawScreen(DX_SCREEN_BACK); // ループ while (ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0) { // 画面を初期化する ClearDrawScreen(); //画面動作処理 mGameScene->Update(); //画面描画処理 mGameScene->Draw(); // 裏画面の内容を表画面に反映させる ScreenFlip(); } DxLib_End(); // DXライブラリ使用の終了処理 return 0; // ソフトの終了 }
//処理初め(0)、処理終わり(1) void ScreenTimer(int Type,int FrameRate) { //タイマー static int Timer = 0; static double Wait = 0.0; //フレームスキップフラグ static int FrameSkip = 0; if(!Type) { Timer = GetNowCount(); ClearDrawScreen(); }else { ShowFPS(); FrameSkip = 0; if(!FrameSkip)ScreenFlip() ; Wait += (1000.0 / FrameRate - (GetNowCount() - Timer)); if(Wait > 0) { Sleep((DWORD)Wait); Wait -= (int)Wait; }else { FrameSkip = 1; } } }
void Game::Flip() const { if (ScreenFlip()) { std::exception("描画スクリーンの切り替えに失敗しました"); } }
bool Process(char key[256]){ if(ScreenFlip()!=0) return 0; if(ProcessMessage()!=0) return 0; if(ClearDrawScreen()!=0) return 0; if(GetHitKeyStateAll(key)!=0) return 0; return 1; }
// -------------- // I_FinishUpdate // -------------- void I_FinishUpdate(void) { if (rendermode == render_none) return; if (I_SkipFrame()) return; // display a graph of ticrate if (cv_ticrate.value) displayticrate(cv_ticrate.value); // if (bDIBMode) { // paranoia if (!hDCMain || !bmiMain || !vid.buffer) return; // main game loop, still in a window (-win parm) SetDIBitsToDevice(hDCMain, 0, 0, vid.width, vid.height, 0, 0, 0, vid.height, vid.buffer, bmiMain, DIB_RGB_COLORS); } else #ifdef HWRENDER if (rendermode != render_soft) HWD.pfnFinishUpdate(cv_vidwait.value); else #endif { // DIRECT DRAW // copy virtual screen to real screen // can fail when not active (alt-tab) if (LockScreen()) { /// \todo use directX blit here!!? a blit might use hardware with access /// to main memory on recent hardware, and software blit of directX may be /// optimized for p2 or mmx?? if (ScreenHeight > vid.height) { UINT8 *ptr = (UINT8 *)ScreenPtr; size_t half_excess = ScreenPitch*(ScreenHeight-vid.height)/2; memset(ptr, 0x1F, half_excess); ptr += half_excess; VID_BlitLinearScreen(screens[0], ptr, vid.width*vid.bpp, vid.height, vid.width*vid.bpp, ScreenPitch); ptr += vid.height*ScreenPitch; memset(ptr, 0x1F, half_excess); } else VID_BlitLinearScreen(screens[0], (UINT8 *)ScreenPtr, vid.width*vid.bpp, vid.height, vid.width*vid.bpp, ScreenPitch); UnlockScreen(); // swap screens ScreenFlip(cv_vidwait.value); } } }
void client_main_backup(){ static Mode status = UNCONNECTED; decoder.initialize(); ClientConnection client(PORT, SERVER_IP); ClearDrawScreen(); const static int titleGraph = LoadGraph( "../graphic/ShootingTitle.jpg"); DrawGraph( 0, 0, titleGraph, false); DrawString( 300, 500, "Now connecting", WHITE); ScreenFlip(); if(!client.connect()){ ClearDrawScreen(); DrawString( 200, 500, "Connect failed. Please set up server first.", WHITE); DrawString( 200, 550, "Shutdown.", WHITE); ScreenFlip(); Sleep( 7000); exit(1); } status = CONNECTED; // 移動ルーチン int fpsTimer = GetNowCount(); Input input; while( 1 ){ input.getKeyInput(); client.send(input.encode()); vector<int> clientMessage; if(client.receive(clientMessage) >= 0){ while(client.receive(clientMessage) >= 0); decoder.draw(clientMessage); } int term; term = GetNowCount()-fpsTimer; if(8-term>0){ Sleep(8-term); } fpsTimer = GetNowCount(); // Windows 特有の面倒な処理をDXライブラリにやらせる // -1 が返ってきたらループを抜ける if( ProcessMessage() < 0 ) break ; // もしESCキーが押されていたらループから抜ける if( CheckHitKey( KEY_INPUT_ESCAPE ) ) break; } }
void Pad::create(){ if ( mInstance ){ DrawString( 0, 0, "二つ以上Padが作られました。", GetColor( 0xff, 0xff, 0xff ) ); ScreenFlip(); WaitKey(); } mInstance = new Pad(); }