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:
parent
6a48d6d664
commit
f8b7f7abd6
@ -68,14 +68,19 @@ namespace xna {
|
||||
}
|
||||
|
||||
int Game::Run() {
|
||||
Initialize();
|
||||
try {
|
||||
Initialize();
|
||||
|
||||
if (graphicsDevice == nullptr) {
|
||||
MessageBox(nullptr, "O dispositivo gráfico não foi inicializado corretamente", "XN65", MB_OK);
|
||||
return EXIT_FAILURE;
|
||||
if (graphicsDevice == nullptr) {
|
||||
MessageBox(nullptr, "O dispositivo gráfico não foi inicializado corretamente", "XN65", MB_OK);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return StartGameLoop();
|
||||
}
|
||||
|
||||
return StartGameLoop();
|
||||
catch (std::exception& e) {
|
||||
MessageBox(nullptr, e.what(), "XN65", MB_OK);
|
||||
}
|
||||
}
|
||||
|
||||
void Game::Initialize() {
|
||||
|
@ -25,10 +25,7 @@ namespace xna {
|
||||
}
|
||||
|
||||
void LoadContent() override {
|
||||
spriteBatch = New<SpriteBatch>(*graphicsDevice);
|
||||
|
||||
auto effect = Content()->Load<PSoundEffect>("ExitReached");
|
||||
|
||||
spriteBatch = New<SpriteBatch>(*graphicsDevice);
|
||||
Game::LoadContent();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user