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 void Exit() = 0;
virtual int Run() = 0; virtual int Run() = 0;
virtual PGameWindow Window() = 0; virtual PGameWindow Window() = 0;
virtual PGraphicsDevice GetGraphicsDevice() = 0;
protected: protected:
virtual void Draw(GameTime const& gameTime) = 0; virtual void Draw(GameTime const& gameTime) = 0;

View File

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

View File

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

View File

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

View File

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