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() {
|
int Game::Run() {
|
||||||
Initialize();
|
try {
|
||||||
|
Initialize();
|
||||||
|
|
||||||
if (graphicsDevice == nullptr) {
|
if (graphicsDevice == nullptr) {
|
||||||
MessageBox(nullptr, "O dispositivo gráfico não foi inicializado corretamente", "XN65", MB_OK);
|
MessageBox(nullptr, "O dispositivo gráfico não foi inicializado corretamente", "XN65", MB_OK);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return StartGameLoop();
|
||||||
}
|
}
|
||||||
|
catch (std::exception& e) {
|
||||||
return StartGameLoop();
|
MessageBox(nullptr, e.what(), "XN65", MB_OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::Initialize() {
|
void Game::Initialize() {
|
||||||
|
@ -25,10 +25,7 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user