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

Renomeia campo _graphicsDevice em Game

This commit is contained in:
Danilo 2024-04-01 14:37:07 -03:00
parent 399e8f8c24
commit 689ef1f199
5 changed files with 13 additions and 10 deletions

View File

@ -15,6 +15,7 @@ namespace xna {
virtual void Exit() = 0;
virtual int Run() = 0;
virtual PGameWindow Window() = 0;
virtual PGraphicsDevice GetGraphicsDevice() = 0;
protected:
virtual void Draw(GameTime const& gameTime) = 0;

View File

@ -16,7 +16,7 @@ namespace xna {
}
int Game::Run() {
if (_graphicsDevice == nullptr) {
if (GraphicsDevice == nullptr) {
MessageBox(nullptr, "O dispositivo gráfico não foi inicializar corretamente", "Xna Game Engine", MB_OK);
return EXIT_FAILURE;
}
@ -42,9 +42,7 @@ namespace xna {
gameTime.ElapsedGameTime = elapsed - endElapsedTime;
gameTime.TotalGameTime = _clock.TotalTime();
this->Update(gameTime);
//_graphicsDevice->Clear();
this->Update(gameTime);
elapsed = _clock.ElapsedTime();
gameTime.ElapsedGameTime = elapsed - endElapsedTime;
@ -52,7 +50,7 @@ namespace xna {
this->Draw(gameTime);
_graphicsDevice->Present();
GraphicsDevice->Present();
endElapsedTime = _clock.ElapsedTime();
}

View File

@ -21,13 +21,17 @@ namespace xna {
return _gameWindow;
}
virtual PGraphicsDevice GetGraphicsDevice() override {
return GraphicsDevice;
}
protected:
virtual void Draw(GameTime const& gameTime) override{}
virtual void Initialize() override{}
virtual void Update(GameTime const& gameTime) override{}
public:
PGraphicsDevice _graphicsDevice{ nullptr };
PGraphicsDevice GraphicsDevice{ nullptr };
protected:
PGameWindow _gameWindow{ nullptr };

View File

@ -44,7 +44,7 @@ namespace xna {
return;
}
_game->_graphicsDevice = _device;
_game->GraphicsDevice = _device;
}
void GraphicsDeviceManager::ChangeDevice() {

View File

@ -15,7 +15,7 @@ using namespace xna;
class Game1 : public Game {
public:
Game1() {
manager = New<GraphicsDeviceManager>(this);
graphics = New<GraphicsDeviceManager>(this);
}
virtual void Update(GameTime const& gameTime) {
@ -24,13 +24,13 @@ public:
}
virtual void Draw(GameTime const& gameTime) {
_graphicsDevice->Clear();
GraphicsDevice->Clear();
Game::Draw(gameTime);
}
private:
PGraphicsDeviceManager manager;
PGraphicsDeviceManager graphics;
};
int APIENTRY WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) {