void BaseAlgorithm::Init(bool testState) { _inTest = testState; InitResult(); if (_inTest) { SetDefaultParams(); InitProcessData(); } _offset = Point(0,0); }
// All files must have the main function. int main(int UNUSED(argc), char **UNUSED(argv)) { Result result; hid_t file_id; InitResult(&result); file_id = CreateTestFile(); if (file_id < 0) { printf("Fail to open temporary test file: %s\n", TEST_FILE); Clean(file_id); return EXIT_FAILURE; } CheckTestResult(TestRead(file_id), &result); Clean(file_id); DisplayResult(&result); return result.status; }
int Game::MainLoop(){ keyboard->Update(); mouse->Update(); int res; //初期化フラグが立っていればそのphaseで必要な初期化をする。 if(phaseinit){ phaseinit=false; switch(phase){ case MENU: Logger::Print("Game : Begin GameMenu"); res=InitMenu(); break; case PLAY: Logger::Print("Game : Begin GamePlay"); res=InitPlay(); break; case RESULT: Logger::Print("Game : Begin GameResult"); res=InitResult(); break; } if(res==-1){ Logger::Print("Game : Initialize Fail"); return -1; } } //メイン処理 switch(phase){ case MENU: res=ProcMenu(); break; case PLAY: res=ProcPlay(); break; case RESULT: res=ProcResult(); break; } //現在のフェイズが終了したらフェイズをひとつ進めて初期化フラグを立てる。 if(res==1){ switch(phase){ case MENU: phase=PLAY; break; case PLAY: phase=RESULT; break; case RESULT: phase=MENU; break; } phaseinit=true; } if(res==-1){ Logger::Print("Game : Exit Program"); return -1; } return 0; }