1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/framework/platform/game-dx.hpp
2024-05-06 10:32:17 -03:00

77 lines
1.6 KiB
C++

#ifndef XNA_PLATFORM_GAME_DX_HPP
#define XNA_PLATFORM_GAME_DX_HPP
#include "../default.hpp"
#include "../game/game.hpp"
#include "dxheaders.hpp"
#include "dx/StepTimer.hpp"
#include "../content/manager.hpp"
namespace xna {
class Game : public IGame {
public:
Game();
virtual ~Game() override {
}
virtual void Exit() override;
virtual int Run() override;
virtual sptr<GameWindow> Window() override {
return _gameWindow;
}
virtual sptr<GraphicsDevice> GetGraphicsDevice() override {
return _graphicsDevice;
}
sptr<GameComponentCollection> Components() override {
return _gameComponents;
}
sptr<GameServiceContainer> Services() override {
return _services;
}
sptr<ContentManager> Content() {
return contentManager;
}
constexpr void EnableGameComponents(bool value) {
_enabledGameComponents = value;
}
protected:
virtual void Draw(GameTime const& gameTime) override;
virtual void Initialize() override;
virtual void LoadContent() override{}
virtual void Update(GameTime const& gameTime) override;
public:
sptr<GraphicsDevice> _graphicsDevice{ nullptr };
protected:
sptr<GameWindow> _gameWindow{ nullptr };
sptr<AudioEngine> _audioEngine = nullptr;
GameTime _currentGameTime{};
DX::StepTimer _stepTimer;
sptr<ContentManager> contentManager;
sptr<GameServiceContainer> _services = nullptr;
private:
int startLoop();
void step();
sptr<GameComponentCollection> _gameComponents = nullptr;
std::vector<sptr<IGameComponent>> _drawableGameComponents;
size_t _drawableGameComponentsCount{ 0 };
bool _enabledGameComponents{ false };
};
}
#endif