1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/framework/platform/spritebatch-dx.hpp
2024-04-14 16:11:15 -03:00

66 lines
2.6 KiB
C++

#ifndef XNA_PLATFORM_SPRITEBATCH_DX_HPP
#define XNA_PLATFORM_SPRITEBATCH_DX_HPP
#include "../graphics/spritebatch.hpp"
#include "SpriteBatch.h"
namespace xna {
class SpriteBatch : public ISpriteBatch {
public:
SpriteBatch(GraphicsDevice& device);
virtual ~SpriteBatch() override {}
virtual void Begin(
SpriteSortMode sortMode = SpriteSortMode::Deferred,
BlendState* blendState = nullptr,
SamplerState* samplerState = nullptr,
//DepthStencilState
RasterizerState* rasterizerState = nullptr,
//Effect
Matrix const& transformMatrix = _identity
) override;
virtual void End() override;
virtual void Draw(Texture2D& texture, Vector2 const& position, Color const& color) override;
virtual void Draw(Texture2D& texture, Vector2 const& position, Rectangle const * sourceRectangle, Color const& color) override;
virtual void Draw(Texture2D& texture, Vector2 const& position, Rectangle const* sourceRectangle, Color const& color,
float rotation, Vector2 const& origin, float scale, SpriteEffects effects, float layerDepth) override;
virtual void Draw(Texture2D& texture, Vector2 const& position, Rectangle const* sourceRectangle, Color const& color,
float rotation, Vector2 const& origin, Vector2 const& scale, SpriteEffects effects, float layerDepth) override;
virtual void Draw(Texture2D& texture, Rectangle const& destinationRectangle, Color const& color) override;
virtual void Draw(Texture2D& texture, Rectangle const& destinationRectangle, Rectangle const* sourceRectangle, Color const& color) override;
virtual void Draw(Texture2D& texture, Rectangle const& destinationRectangle, Rectangle const* sourceRectangle, Color const& color,
float rotation, Vector2 const& origin, SpriteEffects effects, float layerDepth) override;
virtual void Viewport(xna::Viewport const& value) override;
public:
sptr<DirectX::SpriteBatch> _dxspriteBatch = nullptr;
static constexpr void ConvertSpriteSort(SpriteSortMode value, DirectX::SpriteSortMode& target) {
switch (value)
{
case xna::SpriteSortMode::Deferred:
target = DirectX::SpriteSortMode_Deferred;
break;
case xna::SpriteSortMode::Immediate:
target = DirectX::SpriteSortMode_Immediate;
break;
case xna::SpriteSortMode::Texture:
target = DirectX::SpriteSortMode_Texture;
break;
case xna::SpriteSortMode::BackToFront:
target = DirectX::SpriteSortMode_BackToFront;
break;
case xna::SpriteSortMode::FrontToBack:
target = DirectX::SpriteSortMode_FrontToBack;
break;
default:
target = DirectX::SpriteSortMode_Deferred;
break;
}
}
};
}
#endif