mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Adiciona ImplementationBase em GraphicsAdapter
This commit is contained in:
parent
f4a839eac9
commit
adeda5ca67
@ -4,6 +4,11 @@
|
|||||||
#include "headers.hpp"
|
#include "headers.hpp"
|
||||||
|
|
||||||
namespace xna {
|
namespace xna {
|
||||||
|
struct GraphicsAdapter::ImplementationBase::PlatformImplementation {
|
||||||
|
comptr<IDXGIAdapter1> dxAdapter;
|
||||||
|
comptr<IDXGIFactory1> dxFactory;
|
||||||
|
};
|
||||||
|
|
||||||
struct SpriteFont::PlatformImplementation {
|
struct SpriteFont::PlatformImplementation {
|
||||||
uptr<DirectX::SpriteFont> dxSpriteFont{ nullptr };
|
uptr<DirectX::SpriteFont> dxSpriteFont{ nullptr };
|
||||||
};
|
};
|
||||||
@ -12,12 +17,7 @@ namespace xna {
|
|||||||
sptr<DirectX::SpriteBatch> dxSpriteBatch = nullptr;
|
sptr<DirectX::SpriteBatch> dxSpriteBatch = nullptr;
|
||||||
comptr<ID3D11InputLayout> dxInputLayout = nullptr;
|
comptr<ID3D11InputLayout> dxInputLayout = nullptr;
|
||||||
sptr<DirectX::DX11::IEffect> dxEffectBuffer = nullptr;
|
sptr<DirectX::DX11::IEffect> dxEffectBuffer = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GraphicsAdapter::PlatformImplementation {
|
|
||||||
comptr<IDXGIAdapter1> dxAdapter = nullptr;
|
|
||||||
comptr<IDXGIFactory1> dxFactory = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct BlendRenderTarget {
|
struct BlendRenderTarget {
|
||||||
bool Enabled{ true };
|
bool Enabled{ true };
|
||||||
|
@ -1,30 +1,33 @@
|
|||||||
#ifndef XNA_GRAPHICS_ADAPTER_HPP
|
#ifndef XNA_GRAPHICS_ADAPTER_HPP
|
||||||
#define XNA_GRAPHICS_ADAPTER_HPP
|
#define XNA_GRAPHICS_ADAPTER_HPP
|
||||||
|
|
||||||
#include "../default.hpp"
|
|
||||||
#include "displaymode.hpp"
|
#include "displaymode.hpp"
|
||||||
|
#include "../platform.hpp"
|
||||||
|
#include <memory>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace xna {
|
namespace xna {
|
||||||
//Provides methods to retrieve and manipulate graphics adapters.
|
//Provides methods to retrieve and manipulate graphics adapters.
|
||||||
class GraphicsAdapter {
|
class GraphicsAdapter : public ImplementationBase {
|
||||||
public:
|
public:
|
||||||
//Collection of available adapters on the system.
|
//Collection of available adapters on the system.
|
||||||
static void Adapters(std::vector<uptr<GraphicsAdapter>>& adapters);
|
static void Adapters(std::vector<std::unique_ptr<GraphicsAdapter>>& adapters);
|
||||||
|
|
||||||
//Gets the current display mode.
|
//Gets the current display mode.
|
||||||
inline sptr<DisplayMode> CurrentDisplayMode() const { return currentDisplayMode; }
|
inline std::shared_ptr<DisplayMode> CurrentDisplayMode() const { return currentDisplayMode; }
|
||||||
|
|
||||||
//Gets the default adapter.
|
//Gets the default adapter.
|
||||||
static uptr<GraphicsAdapter> DefaultAdapter();
|
static std::unique_ptr<GraphicsAdapter> DefaultAdapter();
|
||||||
|
|
||||||
//Retrieves a string used for presentation to the user.
|
//Retrieves a string used for presentation to the user.
|
||||||
constexpr String Description() const { return description; }
|
constexpr std::string Description() const { return description; }
|
||||||
|
|
||||||
//Retrieves a value that is used to help identify a particular chip set.
|
//Retrieves a value that is used to help identify a particular chip set.
|
||||||
constexpr Uint DeviceId() const { return deviceId; }
|
constexpr uint32_t DeviceId() const { return deviceId; }
|
||||||
|
|
||||||
//Retrieves a string that contains the device name.
|
//Retrieves a string that contains the device name.
|
||||||
constexpr String DeviceName() const { return deviceName; }
|
constexpr std::string DeviceName() const { return deviceName; }
|
||||||
|
|
||||||
//Determines if this instance of GraphicsAdapter is the default adapter.
|
//Determines if this instance of GraphicsAdapter is the default adapter.
|
||||||
constexpr bool IsDefaultAdapter() const { return isDefault; }
|
constexpr bool IsDefaultAdapter() const { return isDefault; }
|
||||||
@ -38,16 +41,16 @@ namespace xna {
|
|||||||
constexpr intptr_t MonitorHandle() const { return monitorHandle; }
|
constexpr intptr_t MonitorHandle() const { return monitorHandle; }
|
||||||
|
|
||||||
//Retrieves a value used to help identify the revision level of a particular chip set.
|
//Retrieves a value used to help identify the revision level of a particular chip set.
|
||||||
constexpr Uint Revision() const { return revision; }
|
constexpr uint32_t Revision() const { return revision; }
|
||||||
|
|
||||||
//Retrieves a value used to identify the subsystem.
|
//Retrieves a value used to identify the subsystem.
|
||||||
constexpr Uint SubSystemId() const { return subSystemId; }
|
constexpr uint32_t SubSystemId() const { return subSystemId; }
|
||||||
|
|
||||||
//Returns a collection of supported display modes for the current adapter.
|
//Returns a collection of supported display modes for the current adapter.
|
||||||
inline sptr<DisplayModeCollection> SupportedDisplayModes() const { return supportedDisplayModes; }
|
inline std::shared_ptr<DisplayModeCollection> SupportedDisplayModes() const { return supportedDisplayModes; }
|
||||||
|
|
||||||
//Retrieves a value used to identify the manufacturer.
|
//Retrieves a value used to identify the manufacturer.
|
||||||
constexpr Uint VendorId() const { return vendorId; }
|
constexpr uint32_t VendorId() const { return vendorId; }
|
||||||
|
|
||||||
//Gets or sets a NULL device.
|
//Gets or sets a NULL device.
|
||||||
static bool UseNullDevice() { return useNullDevice; }
|
static bool UseNullDevice() { return useNullDevice; }
|
||||||
@ -69,32 +72,28 @@ namespace xna {
|
|||||||
GraphicsProfile graphicsProfile,
|
GraphicsProfile graphicsProfile,
|
||||||
SurfaceFormat format,
|
SurfaceFormat format,
|
||||||
DepthFormat depthFormat,
|
DepthFormat depthFormat,
|
||||||
Int multiSampleCount,
|
int32_t multiSampleCount,
|
||||||
SurfaceFormat& selectedFormat,
|
SurfaceFormat& selectedFormat,
|
||||||
DepthFormat& selectedDepthFormat,
|
DepthFormat& selectedDepthFormat,
|
||||||
Int& selectedMultiSampleCount
|
int32_t& selectedMultiSampleCount
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String description;
|
std::string description;
|
||||||
Uint deviceId{0};
|
uint32_t deviceId{0};
|
||||||
String deviceName;
|
std::string deviceName;
|
||||||
bool isDefault{ false };
|
bool isDefault{ false };
|
||||||
intptr_t monitorHandle{ 0 };
|
intptr_t monitorHandle{ 0 };
|
||||||
Uint revision{ 0 };
|
uint32_t revision{ 0 };
|
||||||
Uint subSystemId{ 0 };
|
uint32_t subSystemId{ 0 };
|
||||||
Uint vendorId{ 0 };
|
uint32_t vendorId{ 0 };
|
||||||
sptr<DisplayMode> currentDisplayMode{ nullptr };
|
std::shared_ptr<DisplayMode> currentDisplayMode{ nullptr };
|
||||||
sptr<DisplayModeCollection> supportedDisplayModes{ nullptr };
|
std::shared_ptr<DisplayModeCollection> supportedDisplayModes{ nullptr };
|
||||||
|
|
||||||
inline static bool useNullDevice = false;
|
inline static bool useNullDevice = false;
|
||||||
inline static bool useReferenceDevice = false;
|
inline static bool useReferenceDevice = false;
|
||||||
|
|
||||||
GraphicsAdapter();
|
GraphicsAdapter();
|
||||||
|
|
||||||
public:
|
|
||||||
struct PlatformImplementation;
|
|
||||||
uptr<PlatformImplementation> impl = nullptr;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
includes/xna/platform.hpp
Normal file
13
includes/xna/platform.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef XNA_PLATFORM_HPP
|
||||||
|
#define XNA_PLATFORM_HPP
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace xna {
|
||||||
|
struct ImplementationBase {
|
||||||
|
struct PlatformImplementation;
|
||||||
|
std::unique_ptr<PlatformImplementation> impl;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
# Add source to this project's executable.
|
# Add source to this project's executable.
|
||||||
add_subdirectory ("01_blank")
|
add_subdirectory ("01_blank")
|
||||||
#add_subdirectory ("02_PlatfformerStarterKit")
|
add_subdirectory ("02_PlatfformerStarterKit")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user