1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00

Implementa bloco try/catch em Game

This commit is contained in:
Danilo 2024-05-28 14:43:56 -03:00
parent 6a48d6d664
commit f8b7f7abd6
2 changed files with 12 additions and 10 deletions

View File

@ -68,6 +68,7 @@ namespace xna {
} }
int Game::Run() { int Game::Run() {
try {
Initialize(); Initialize();
if (graphicsDevice == nullptr) { if (graphicsDevice == nullptr) {
@ -77,6 +78,10 @@ namespace xna {
return StartGameLoop(); return StartGameLoop();
} }
catch (std::exception& e) {
MessageBox(nullptr, e.what(), "XN65", MB_OK);
}
}
void Game::Initialize() { void Game::Initialize() {
Keyboard::Initialize(); Keyboard::Initialize();

View File

@ -26,9 +26,6 @@ namespace xna {
void LoadContent() override { void LoadContent() override {
spriteBatch = New<SpriteBatch>(*graphicsDevice); spriteBatch = New<SpriteBatch>(*graphicsDevice);
auto effect = Content()->Load<PSoundEffect>("ExitReached");
Game::LoadContent(); Game::LoadContent();
} }