2024-03-21 16:01:47 -03:00
|
|
|
#ifndef XNA_PLATFORM_GAME_DX_HPP
|
|
|
|
#define XNA_PLATFORM_GAME_DX_HPP
|
|
|
|
|
2024-04-20 13:39:19 -03:00
|
|
|
#include "../default.hpp"
|
2024-03-21 16:01:47 -03:00
|
|
|
#include "../game/game.hpp"
|
2024-04-23 16:11:17 -03:00
|
|
|
#include "dxheaders.hpp"
|
|
|
|
#include "dx/StepTimer.hpp"
|
2024-05-06 10:32:17 -03:00
|
|
|
#include "../content/manager.hpp"
|
2024-03-21 16:01:47 -03:00
|
|
|
|
|
|
|
namespace xna {
|
|
|
|
class Game : public IGame {
|
|
|
|
public:
|
|
|
|
Game();
|
|
|
|
|
|
|
|
virtual ~Game() override {
|
|
|
|
}
|
|
|
|
|
2024-04-22 16:14:55 -03:00
|
|
|
virtual void Exit() override;
|
|
|
|
|
2024-03-21 16:01:47 -03:00
|
|
|
virtual int Run() override;
|
2024-03-30 14:25:08 -03:00
|
|
|
|
2024-04-26 11:35:59 -03:00
|
|
|
virtual sptr<GameWindow> Window() override {
|
2024-03-30 14:25:08 -03:00
|
|
|
return _gameWindow;
|
|
|
|
}
|
2024-03-21 16:01:47 -03:00
|
|
|
|
2024-04-26 11:35:59 -03:00
|
|
|
virtual sptr<GraphicsDevice> GetGraphicsDevice() override {
|
2024-04-07 14:06:12 -03:00
|
|
|
return _graphicsDevice;
|
2024-04-01 14:37:07 -03:00
|
|
|
}
|
|
|
|
|
2024-04-27 00:10:07 -03:00
|
|
|
sptr<GameComponentCollection> Components() override {
|
|
|
|
return _gameComponents;
|
|
|
|
}
|
|
|
|
|
2024-05-06 10:32:17 -03:00
|
|
|
sptr<GameServiceContainer> Services() override {
|
|
|
|
return _services;
|
|
|
|
}
|
|
|
|
|
|
|
|
sptr<ContentManager> Content() {
|
|
|
|
return contentManager;
|
|
|
|
}
|
|
|
|
|
2024-04-27 15:21:47 -03:00
|
|
|
constexpr void EnableGameComponents(bool value) {
|
|
|
|
_enabledGameComponents = value;
|
2024-04-27 00:10:07 -03:00
|
|
|
}
|
|
|
|
|
2024-03-21 16:01:47 -03:00
|
|
|
protected:
|
2024-04-23 16:11:17 -03:00
|
|
|
virtual void Draw(GameTime const& gameTime) override;
|
2024-04-20 13:39:19 -03:00
|
|
|
|
|
|
|
virtual void Initialize() override;
|
|
|
|
|
2024-04-16 16:13:36 -03:00
|
|
|
virtual void LoadContent() override{}
|
2024-04-20 13:39:19 -03:00
|
|
|
|
|
|
|
virtual void Update(GameTime const& gameTime) override;
|
2024-03-21 16:01:47 -03:00
|
|
|
|
2024-04-01 11:29:32 -03:00
|
|
|
public:
|
2024-04-26 11:35:59 -03:00
|
|
|
sptr<GraphicsDevice> _graphicsDevice{ nullptr };
|
2024-04-01 11:29:32 -03:00
|
|
|
|
|
|
|
protected:
|
2024-04-26 11:35:59 -03:00
|
|
|
sptr<GameWindow> _gameWindow{ nullptr };
|
|
|
|
sptr<AudioEngine> _audioEngine = nullptr;
|
2024-03-21 16:01:47 -03:00
|
|
|
|
2024-03-23 17:23:07 -03:00
|
|
|
GameTime _currentGameTime{};
|
2024-04-23 16:11:17 -03:00
|
|
|
DX::StepTimer _stepTimer;
|
2024-05-06 10:32:17 -03:00
|
|
|
sptr<ContentManager> contentManager;
|
|
|
|
sptr<GameServiceContainer> _services = nullptr;
|
|
|
|
|
2024-04-16 16:13:36 -03:00
|
|
|
private:
|
|
|
|
int startLoop();
|
2024-04-23 16:11:17 -03:00
|
|
|
void step();
|
2024-04-27 00:10:07 -03:00
|
|
|
sptr<GameComponentCollection> _gameComponents = nullptr;
|
|
|
|
std::vector<sptr<IGameComponent>> _drawableGameComponents;
|
2024-04-28 20:19:37 -03:00
|
|
|
size_t _drawableGameComponentsCount{ 0 };
|
2024-05-06 10:32:17 -03:00
|
|
|
bool _enabledGameComponents{ false };
|
2024-03-21 16:01:47 -03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|