mirror of
https://github.com/borgesdan/xn65
synced 2024-12-29 21:54:47 +01:00
Remove PlatformImplementation
This commit is contained in:
parent
61da1aac46
commit
f5049cae2a
@ -1,7 +1,6 @@
|
||||
#ifndef XNA_GRAPHICS_ADAPTER_HPP
|
||||
#define XNA_GRAPHICS_ADAPTER_HPP
|
||||
|
||||
#include "../platform.hpp"
|
||||
#include "displaymode.hpp"
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
@ -12,7 +11,7 @@ namespace xna {
|
||||
struct GraphicsAdapterImplementation;
|
||||
|
||||
//Provides methods to retrieve and manipulate graphics adapters.
|
||||
class GraphicsAdapter : public PlatformImplementation<GraphicsAdapterImplementation> {
|
||||
class GraphicsAdapter {
|
||||
public:
|
||||
//Collection of available adapters on the system.
|
||||
static void Adapters(std::vector<std::unique_ptr<GraphicsAdapter>>& adapters);
|
||||
@ -81,6 +80,8 @@ namespace xna {
|
||||
int32_t& selectedMultiSampleCount
|
||||
) const;
|
||||
|
||||
std::unique_ptr<GraphicsAdapterImplementation> Implementation;
|
||||
|
||||
private:
|
||||
std::string description;
|
||||
uint32_t deviceId{0};
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define XNA_GRAPHICS_BLENDSTATE_HPP
|
||||
|
||||
#include "../common/color.hpp"
|
||||
#include "../platform.hpp"
|
||||
#include "gresource.hpp"
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
@ -104,7 +103,7 @@ namespace xna {
|
||||
struct BlendStateImplementation;
|
||||
|
||||
//Contains blend state for the device.
|
||||
class BlendState : public GraphicsResource, public PlatformImplementation<BlendStateImplementation> {
|
||||
class BlendState : public GraphicsResource {
|
||||
public:
|
||||
BlendState();
|
||||
BlendState(std::shared_ptr<GraphicsDevice> const& device);
|
||||
@ -168,6 +167,8 @@ namespace xna {
|
||||
//A built-in state object with settings for blending with non-premultipled alpha,
|
||||
//that is blending source and destination data using alpha while assuming the color data contains no alpha information.
|
||||
static std::unique_ptr<BlendState> NonPremultiplied();
|
||||
|
||||
std::unique_ptr< BlendStateImplementation> Implementation;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP
|
||||
#define XNA_GRAPHICS_DEPTHSTENCILSTATE_HPP
|
||||
|
||||
#include "../platform.hpp"
|
||||
#include "gresource.hpp"
|
||||
#include "shared.hpp"
|
||||
#include <cstdint>
|
||||
@ -23,7 +22,7 @@ namespace xna {
|
||||
struct DepthStencilStateImplementation;
|
||||
|
||||
//Contains depth-stencil state for the device.
|
||||
class DepthStencilState : public GraphicsResource, public PlatformImplementation<DepthStencilStateImplementation> {
|
||||
class DepthStencilState : public GraphicsResource {
|
||||
public:
|
||||
DepthStencilState();
|
||||
DepthStencilState(std::shared_ptr<GraphicsDevice> const& device);
|
||||
@ -104,6 +103,8 @@ namespace xna {
|
||||
|
||||
bool Initialize();
|
||||
bool Apply();
|
||||
|
||||
std::unique_ptr<DepthStencilStateImplementation> Implementation;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef XNA_GRAPHICS_DEVICE_HPP
|
||||
#define XNA_GRAPHICS_DEVICE_HPP
|
||||
|
||||
#include "../platform.hpp"
|
||||
#include "presentparams.hpp"
|
||||
#include "viewport.hpp"
|
||||
#include <memory>
|
||||
@ -10,10 +9,10 @@ namespace xna {
|
||||
struct GraphicsDeviceImplementation;
|
||||
|
||||
//Performs primitive-based rendering, creates resources, handles system-level variables, adjusts gamma ramp levels, and creates shaders.
|
||||
class GraphicsDevice : public std::enable_shared_from_this<GraphicsDevice>, public PlatformImplementation<GraphicsDeviceImplementation> {
|
||||
class GraphicsDevice : public std::enable_shared_from_this<GraphicsDevice> {
|
||||
public:
|
||||
GraphicsDevice();
|
||||
|
||||
|
||||
GraphicsDevice(
|
||||
std::shared_ptr<GraphicsAdapter> const& adapter,
|
||||
GraphicsProfile const& graphicsProfile,
|
||||
@ -42,9 +41,9 @@ namespace xna {
|
||||
//Clears resource buffers.
|
||||
void Clear(Color const& color) const;
|
||||
//Clears resource buffers.
|
||||
void Clear(ClearOptions options, Color const& color, float depth, Int stencil) const;
|
||||
void Clear(ClearOptions options, Color const& color, float depth, Int stencil) const;
|
||||
//Presents the display with the contents of the next buffer in the sequence of back buffers owned by the GraphicsDevice.
|
||||
bool Present() const;
|
||||
bool Present() const;
|
||||
//Resets the presentation parameters for the current GraphicsDevice.
|
||||
void Reset(std::shared_ptr<PresentationParameters> const& presentationParameters, std::shared_ptr<GraphicsAdapter> const& graphicsAdapter);
|
||||
//Gets or sets a viewport identifying the portion of the render target to receive draw calls.
|
||||
@ -56,6 +55,8 @@ namespace xna {
|
||||
|
||||
void Initialize();
|
||||
|
||||
std::unique_ptr<GraphicsDeviceImplementation> Implementation;
|
||||
|
||||
private:
|
||||
std::shared_ptr<GraphicsAdapter> adapter{ nullptr };
|
||||
std::shared_ptr<xna::BlendState> blendState{ nullptr };
|
||||
@ -65,7 +66,7 @@ namespace xna {
|
||||
std::shared_ptr<PresentationParameters> presentationParameters{ nullptr };
|
||||
std::shared_ptr<RenderTarget2D> renderTarget{ nullptr };
|
||||
GraphicsProfile graphicsProfile{ GraphicsProfile::HiDef };
|
||||
xna::Viewport viewport{};
|
||||
xna::Viewport viewport{};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define XNA_GRAPHICS_RASTERIZER_HPP
|
||||
|
||||
#include "gresource.hpp"
|
||||
#include "../platform.hpp"
|
||||
|
||||
namespace xna {
|
||||
|
||||
@ -28,7 +27,7 @@ namespace xna {
|
||||
struct RasterizerStateImplementation;
|
||||
|
||||
//Contains rasterizer state, which determines how to convert vector data (shapes) into raster data (pixels).
|
||||
class RasterizerState : public GraphicsResource, public PlatformImplementation<RasterizerStateImplementation> {
|
||||
class RasterizerState : public GraphicsResource {
|
||||
public:
|
||||
RasterizerState();
|
||||
RasterizerState(std::shared_ptr<GraphicsDevice> const& device);
|
||||
@ -75,6 +74,8 @@ namespace xna {
|
||||
|
||||
bool Initialize();
|
||||
bool Apply();
|
||||
|
||||
std::unique_ptr<RasterizerStateImplementation> Implementation;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef XNA_GRAPHICS_SAMPLERSTATE_HPP
|
||||
#define XNA_GRAPHICS_SAMPLERSTATE_HPP
|
||||
|
||||
#include "../platform.hpp"
|
||||
#include "gresource.hpp"
|
||||
#include "shared.hpp"
|
||||
#include <memory>
|
||||
@ -50,7 +49,7 @@ namespace xna {
|
||||
struct SamplerStateImplementation;
|
||||
|
||||
//Contains sampler state, which determines how to sample texture data.
|
||||
class SamplerState : public GraphicsResource, public PlatformImplementation<SamplerStateImplementation> {
|
||||
class SamplerState : public GraphicsResource {
|
||||
public:
|
||||
SamplerState();
|
||||
SamplerState(std::shared_ptr<GraphicsDevice> const& device);
|
||||
@ -109,6 +108,8 @@ namespace xna {
|
||||
|
||||
bool Initialize();
|
||||
bool Apply();
|
||||
|
||||
std::unique_ptr<SamplerStateImplementation> Implementation;
|
||||
};
|
||||
|
||||
//Collection of SamplerState objects.
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "../common/color.hpp"
|
||||
#include "../common/numerics.hpp"
|
||||
#include "../graphics/gresource.hpp"
|
||||
#include "../platform.hpp"
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@ -35,7 +34,7 @@ namespace xna {
|
||||
struct SpriteBatchImplementation;
|
||||
|
||||
//Enables a group of sprites to be drawn using the same settings.
|
||||
class SpriteBatch : public GraphicsResource, public PlatformImplementation<SpriteBatchImplementation> {
|
||||
class SpriteBatch : public GraphicsResource {
|
||||
public:
|
||||
SpriteBatch(std::shared_ptr<GraphicsDevice> const& device);
|
||||
|
||||
@ -147,12 +146,14 @@ namespace xna {
|
||||
float rotation, Vector2 const& origin, float scale, SpriteEffects effects, float layerDepth) { DrawString(*spriteFont, text, position, color, rotation, origin, scale, effects, layerDepth); }
|
||||
void DrawString(SpriteFont& spriteFont, std::string const& text, Vector2 const& position, Color const& color,
|
||||
float rotation, Vector2 const& origin, float scale, SpriteEffects effects, float layerDepth);
|
||||
|
||||
std::unique_ptr<SpriteBatchImplementation> Implementation;
|
||||
};
|
||||
|
||||
struct SpriteFontImplementation;
|
||||
|
||||
//Represents a font texture.
|
||||
class SpriteFont : public PlatformImplementation<SpriteFontImplementation> {
|
||||
class SpriteFont {
|
||||
public:
|
||||
SpriteFont(
|
||||
std::shared_ptr<Texture2D> const& texture,
|
||||
@ -177,6 +178,8 @@ namespace xna {
|
||||
int32_t LineSpacing() const;
|
||||
//Gets or sets the vertical distance (in pixels) between the base lines of two consecutive lines of text
|
||||
void LineSpacing(float value);
|
||||
|
||||
std::unique_ptr<SpriteFontImplementation> Implementation;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
#define XNA_GRAPHICS_TEXTURE_HPP
|
||||
|
||||
#include "../csharp/stream.hpp"
|
||||
#include "../platform.hpp"
|
||||
#include "gresource.hpp"
|
||||
#include "shared.hpp"
|
||||
#include <cstdint>
|
||||
@ -24,7 +23,7 @@ namespace xna {
|
||||
struct Texture2DImplementation;
|
||||
|
||||
//Represents a 2D grid of texels.
|
||||
class Texture2D : public Texture, public PlatformImplementation<Texture2DImplementation> {
|
||||
class Texture2D : public Texture {
|
||||
public:
|
||||
Texture2D();
|
||||
Texture2D(std::shared_ptr<GraphicsDevice> const& device);
|
||||
@ -60,6 +59,8 @@ namespace xna {
|
||||
|
||||
void Initialize();
|
||||
|
||||
std::unique_ptr<Texture2DImplementation> Implementation;
|
||||
|
||||
protected:
|
||||
SurfaceFormat surfaceFormat{ SurfaceFormat::Color };
|
||||
int32_t levelCount{ 0 };
|
||||
|
@ -1,14 +0,0 @@
|
||||
#ifndef XNA_PLATFORM_HPP
|
||||
#define XNA_PLATFORM_HPP
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace xna {
|
||||
template <typename T> struct PlatformImplementation {
|
||||
virtual ~PlatformImplementation() {}
|
||||
|
||||
std::unique_ptr<T> Implementation;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user