int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int){ ChangeWindowMode(TRUE), DxLib_Init(), SetDrawScreen(DX_SCREEN_BACK); //ウィンドウモード変更と初期化と裏画面設定 init(); load(); sound(); while (ScreenFlip() == 0 && ProcessMessage() == 0 && ClearDrawScreen() == 0 && gpUpdateKey() == 0){ //ClsDrawScreen(); if (Key[KEY_INPUT_RIGHT] >= 1){ // 右キーが押されていたら x = x + 5; // 右へ移動 } if (Key[KEY_INPUT_DOWN] >= 1){ // 下キーが押されていたら y = y + 5; // 下へ移動 } if (Key[KEY_INPUT_LEFT] >= 1){ // 左キーが押されていたら x = x - 5; // 左へ移動 } if (Key[KEY_INPUT_UP] >= 1){ // 上キーが押されていたら y = y - 5; // 上へ移動 } switch (Menucount){ case 1:Menu(); break; case 2:Easy(); break; case 3:Normal(); break; case 4:Hard(); break; case 5:Result(); break; case 6:Help(); break; } PlaySoundMem(gamemusic, DX_PLAYTYPE_BACK, FALSE); Update(); //更新 FPSDraw(); //描画 Wait(); //待機 if (Key[KEY_INPUT_ESCAPE] == 1) DxLib_End(); // DXライブラリ終了処理 } 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; }
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){ ChangeWindowMode(TRUE), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK ); //ウィンドウモード変更と初期化と裏画面設定 GameInit(); // 裏画面を表画面に反映, メッセージ処理, 画面クリア while(ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0){// gpUpdateKey(); if(game == start){ GameStart(); }else if(game == playing){ GamePlaying(); }else{ GameOver(); } DrawBox(FieldLeft, FieldTop, FieldRight, FieldBottom, GetColor(255, 255, 255), FALSE); //フィールドの表示 } DxLib_End(); // DXライブラリ終了処理 return 0; }
// 更新 void CPlayer::Update(){ gpUpdateKey(); MoveUpdate(); Shot(); BulletUpdate(); }