Refactor Controller in main to use std::unique_ptr
This commit is contained in:
@@ -35,18 +35,18 @@ int main(int argc, char** argv) {
|
|||||||
SDL_SetMainReady();
|
SDL_SetMainReady();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
core::Controller controller;
|
auto controller = std::make_unique<core::Controller>();
|
||||||
EXIT_IF_ERROR(controller.OnEntry(rom_filename))
|
EXIT_IF_ERROR(controller->OnEntry(rom_filename))
|
||||||
|
|
||||||
while (controller.IsActive()) {
|
while (controller->IsActive()) {
|
||||||
controller.OnInput();
|
controller->OnInput();
|
||||||
if (auto status = controller.OnLoad(); !status.ok()) {
|
if (auto status = controller->OnLoad(); !status.ok()) {
|
||||||
std::cerr << status.message() << std::endl;
|
std::cerr << status.message() << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
controller.DoRender();
|
controller->DoRender();
|
||||||
}
|
}
|
||||||
controller.OnExit();
|
controller->OnExit();
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user