2024-03-18 15:41:46 -03:00
|
|
|
#ifndef XNA_GRAPHICS_DEVICE_HPP
|
|
|
|
#define XNA_GRAPHICS_DEVICE_HPP
|
|
|
|
|
|
|
|
#include "../enums.hpp"
|
|
|
|
#include "../forward.hpp"
|
|
|
|
#include "../game/window.hpp"
|
|
|
|
#include "../types.hpp"
|
|
|
|
#include "adapter.hpp"
|
|
|
|
#include "rendertarget.hpp"
|
|
|
|
#include "swapchain.hpp"
|
|
|
|
#include "viewport.hpp"
|
|
|
|
#include "blendstate.hpp"
|
|
|
|
|
|
|
|
namespace xna {
|
2024-03-21 16:01:47 -03:00
|
|
|
class IGraphicsDevice {
|
2024-03-18 15:41:46 -03:00
|
|
|
public:
|
2024-03-21 16:01:47 -03:00
|
|
|
virtual ~IGraphicsDevice() {}
|
|
|
|
virtual void Clear() = 0;
|
|
|
|
virtual bool Initialize(GameWindow& gameWindow) = 0;
|
|
|
|
virtual bool Present() = 0;
|
2024-03-18 15:41:46 -03:00
|
|
|
|
|
|
|
PGraphicsAdapter Adapter() const {
|
|
|
|
return _adapter;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Adapter(PGraphicsAdapter const& adapter) {
|
|
|
|
_adapter = adapter;
|
2024-03-21 16:01:47 -03:00
|
|
|
}
|
2024-03-18 15:41:46 -03:00
|
|
|
|
|
|
|
constexpr xna::Viewport Viewport() const {
|
|
|
|
return _viewport;
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr void Viewport(xna::Viewport const& viewport) {
|
|
|
|
_viewport = viewport;
|
|
|
|
}
|
|
|
|
|
|
|
|
PSwapChain GetSwapChain() const {
|
|
|
|
return _swapChain;
|
|
|
|
}
|
|
|
|
|
2024-03-21 16:01:47 -03:00
|
|
|
constexpr void UseVSync(bool use) {
|
|
|
|
_usevsync = use;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2024-03-18 15:41:46 -03:00
|
|
|
PGraphicsAdapter _adapter{ nullptr };
|
|
|
|
PSwapChain _swapChain{ nullptr };
|
|
|
|
PRenderTarget2D _renderTarget2D{ nullptr };
|
|
|
|
xna::Viewport _viewport{};
|
|
|
|
PBlendState _blendState{ nullptr };
|
2024-03-21 16:01:47 -03:00
|
|
|
bool _usevsync{ false };
|
2024-03-18 15:41:46 -03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|