#ifndef XNA_GRAPHICS_SPRITE_HPP #define XNA_GRAPHICS_SPRITE_HPP #include "../default.hpp" #include "common/numerics.hpp" #include "common/color.hpp" #include namespace xna { class SpriteBatch { public: SpriteBatch(GraphicsDevice& device); ~SpriteBatch(); void Begin( SpriteSortMode sortMode = SpriteSortMode::Deferred, BlendState* blendState = nullptr, SamplerState* samplerState = nullptr, DepthStencilState* depthStencil = nullptr, RasterizerState* rasterizerState = nullptr, //Effect Matrix const& transformMatrix = Matrix::Identity() ); void End(); void Draw(sptr const& texture, Vector2 const& position, Color const& color) { Draw(*texture, position, color); } void Draw(Texture2D& texture, Vector2 const& position, Color const& color); void Draw(sptr const& texture, Vector2 const& position, Rectangle const* sourceRectangle, Color const& color) { Draw(*texture, position, sourceRectangle, color); } void Draw(Texture2D& texture, Vector2 const& position, Rectangle const* sourceRectangle, Color const& color); void Draw(sptr const& texture, Vector2 const& position, Rectangle const* sourceRectangle, Color const& color, float rotation, Vector2 const& origin, float scale, SpriteEffects effects, float layerDepth) { Draw(*texture, position, sourceRectangle, color, rotation, origin, scale, effects, layerDepth); } void Draw(Texture2D& texture, Vector2 const& position, Rectangle const* sourceRectangle, Color const& color, float rotation, Vector2 const& origin, float scale, SpriteEffects effects, float layerDepth); void Draw(sptr const& texture, Vector2 const& position, Rectangle const* sourceRectangle, Color const& color, float rotation, Vector2 const& origin, Vector2 const& scale, SpriteEffects effects, float layerDepth) { Draw(*texture, position, sourceRectangle, color, rotation, origin, scale, effects, layerDepth); } 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); void Draw(sptr const& texture, Rectangle const& destinationRectangle, Color const& color) { Draw(*texture, destinationRectangle, color); } void Draw(Texture2D& texture, Rectangle const& destinationRectangle, Color const& color); void Draw(sptr const& texture, Rectangle const& destinationRectangle, Rectangle const* sourceRectangle, Color const& color) { Draw(*texture, destinationRectangle, sourceRectangle, color); } void Draw(Texture2D& texture, Rectangle const& destinationRectangle, Rectangle const* sourceRectangle, Color const& color); void Draw(sptr const& texture, Rectangle const& destinationRectangle, Rectangle const* sourceRectangle, Color const& color, float rotation, Vector2 const& origin, SpriteEffects effects, float layerDepth) { Draw(*texture, destinationRectangle, sourceRectangle, color, rotation, origin, effects, layerDepth); } void Draw(Texture2D& texture, Rectangle const& destinationRectangle, Rectangle const* sourceRectangle, Color const& color, float rotation, Vector2 const& origin, SpriteEffects effects, float layerDepth); void Viewport(xna::Viewport const& value); void DrawString(sptr const& spriteFont, String const& text, Vector2 const& position, Color const& color) { DrawString(*spriteFont, text, position, color); } void DrawString(SpriteFont& spriteFont, String const& text, Vector2 const& position, Color const& color); void DrawString(sptr const& spriteFont, String const& text, Vector2 const& position, Color const& color, 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, String const& text, Vector2 const& position, Color const& color, float rotation, Vector2 const& origin, float scale, SpriteEffects effects, float layerDepth); public: struct PlatformImplementation; uptr implementation = nullptr; }; class SpriteFont { public: SpriteFont( sptr const& texture, std::vector const& glyphs, std::vector const& cropping, std::vector const& charMap, Int lineSpacing, float spacing, std::vector const& kerning, std::optional defaultCharacter); ~SpriteFont(); Vector2 MeasureString(String const& text, bool ignoreWhiteSpace = false); Vector2 MeasureString(WString const& text, bool ignoreWhiteSpace = false); private: sptr textureValue = nullptr; std::vector glyphData; std::vector croppingData; std::vector characterMap; Int lineSpacing{0}; float spacing{0}; std::vector kerning; std::optional defaultCharacter; public: struct PlatformImplementation; uptr impl = nullptr; }; using PSpriteFont = sptr; } #endif