string SimpleDriver::drive(string sensors) { CarState cs(sensors); CarControl nextVector = CarControl(0.0f, 0.0f, cs.getGear(), 0.0f, 0.0f); if (automatedControl == NULL) { Keyboard_Update(&nextVector); log->push_back(pair<CarState, CarControl>(cs, nextVector)); } else { this->automatedControl->generateVector(&cs, &nextVector); } return nextVector.toString(); }
int GameUpdate(TGAME* Juego){ Juego->GanadorEncontrado = CheckFull(); Keyboard_Update(&(Juego->Teclado)); if(Keyboard_Check(&(Juego->Teclado), eKey_Esc)){ Juego->EstadoActual = Terminado; return 0; } if(Juego->GanadorEncontrado){ Juego->EstadoActual = Lleno; if(Keyboard_Check(&(Juego->Teclado), eKey_Enter)){ GameInit(Juego); } return 0; } if(!(Juego->pos_o_linea)){ CheckForWin(Juego); } if(Keyboard_Check(&(Juego->Teclado), eKey_Enter) && Juego->pos_o_linea==false){ Sleep(200); Juego->pos_o_linea = !(Juego->pos_o_linea); //GraphicManager_WriteChar(&(Juego->Pantalla), pos_cursor[0], pos_cursor[1], ' '); if(pos_cursor[0]<48) Juego->eLinea = Right; else Juego->eLinea = Left; } else if(Keyboard_Check(&(Juego->Teclado), eKey_Enter) && Juego->pos_o_linea==true){ Juego->pos_o_linea = !(Juego->pos_o_linea); // GraphicManager_WriteChar(&(Juego->Pantalla), pos_cursor[0], pos_cursor[1], ' '); } return 0; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { SetWindowIconID(IDI_ICON1); SetMainWindowText(titlebar),ChangeWindowMode(TRUE), SetGraphMode(WIDTH, HEIGHT, 32), DxLib_Init(),SetDrawScreen(DX_SCREEN_BACK); //ウィンドウモード、960*720のサイズ //画像の読み込み GraphicHandle[0] = LoadGraph("image/Title.png"); GraphicHandle[1] = LoadGraph("image/Player.png"); GraphicHandle[2] = LoadGraph("image/Comet.png"); GraphicHandle[3] = LoadGraph("image/Backscreen.png"); GraphicHandle[4] = LoadGraph("image/Clearscreen.png"); GraphicHandle[5] = LoadGraph("image/Sf_title.png"); GraphicHandle[6] = LoadGraph("image/Buttun_on.png"); GraphicHandle[7] = LoadGraph("image/Buttun_off.png"); GraphicHandle[8] = LoadGraph("image/Ready.png"); GraphicHandle[9] = LoadGraph("image/Start.png"); GraphicHandle[10] = MakeScreen(1024, 1024, false); GraphicHandle[11] = LoadGraph("image/Ranking.png"); GraphicHandle[12] = LoadGraph("image/Pause.png"); //音楽の読み込み SoundHandle[0] = LoadSoundMem("music/bgm.mp3"); SoundHandle[1] = LoadSoundMem("music/select.mp3"); SoundHandle[2] = LoadSoundMem("music/deside.mp3"); SoundHandle[3] = LoadSoundMem("music/miss.mp3"); SoundHandle[4] = LoadSoundMem("music/gameover.mp3"); GScoreFont = CreateFontToHandle("Meiryo UI Bold", 20, -1); RScoreFont = CreateFontToHandle("Meiryo UI Bold", 32, -1); CScoreFont = CreateFontToHandle("Meiryo UI Bold", 64, -1); ChangeFont("Meiryo UI Bold"); //フォントの変更 Title_Initialize(); //タイトルの初期化処理 Game_Initialize(); //ゲームの初期化処理 Clear_Initialize(); //クリア画面の初期化処理 Rank_Initialize(); //ランキング画面の初期化処理 Logo_Initialize(); while (Loop() == true) { Keyboard_Update(); GamePad_Update(); switch (NowScene()) { //現在のシーンによって動作を変える case logo: Logo_Update(); break; case title: Title_Update(); Title_Draw(); break; case gamepre: Game_Initialize(); ChangeScene(game); case game: Game_Update(); Game_Draw(); break; case clear: Clear_Update(); Clear_Draw(); break; } } Title_Finalize(); //タイトルの終了処理 Game_Finalize(); //ゲームの終了処理 Clear_Finalize(); //クリア画面の終了処理 Rank_Finalize(); //ランキング画面の終了処理 Logo_Finalize(); //ロゴ画面の終了処理 DxLib_End(); // DXライブラリ使用の終了処理 return 0; }