2024-05-18 21:14:56 -03:00
|
|
|
#ifndef XNA_GRAPHICS_SPRITE_HPP
|
|
|
|
#define XNA_GRAPHICS_SPRITE_HPP
|
2024-04-14 16:11:15 -03:00
|
|
|
|
|
|
|
#include "../default.hpp"
|
2024-05-18 16:30:48 -03:00
|
|
|
#include "../common/numerics.hpp"
|
2024-05-18 21:14:56 -03:00
|
|
|
#include "common/color.hpp"
|
2024-04-14 16:11:15 -03:00
|
|
|
|
|
|
|
namespace xna {
|
2024-05-18 19:58:38 -03:00
|
|
|
class SpriteBatch {
|
2024-04-14 16:11:15 -03:00
|
|
|
public:
|
2024-05-18 19:58:38 -03:00
|
|
|
SpriteBatch(GraphicsDevice& device);
|
|
|
|
~SpriteBatch();
|
|
|
|
void Begin(
|
2024-04-14 16:11:15 -03:00
|
|
|
SpriteSortMode sortMode = SpriteSortMode::Deferred,
|
|
|
|
BlendState* blendState = nullptr,
|
|
|
|
SamplerState* samplerState = nullptr,
|
2024-05-18 19:58:38 -03:00
|
|
|
DepthStencilState* depthStencil = nullptr,
|
2024-04-14 16:11:15 -03:00
|
|
|
RasterizerState* rasterizerState = nullptr,
|
2024-05-18 19:58:38 -03:00
|
|
|
//Effect
|
2024-04-16 16:13:36 -03:00
|
|
|
Matrix const& transformMatrix = Matrix::Identity()
|
2024-05-18 19:58:38 -03:00
|
|
|
);
|
|
|
|
void End();
|
|
|
|
void Draw(Texture2D& texture, Vector2 const& position, Color const& color);
|
|
|
|
void Draw(Texture2D& texture, Vector2 const& position, Rectangle const* sourceRectangle, Color const& color);
|
|
|
|
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(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(Texture2D& texture, Rectangle const& destinationRectangle, Color const& color);
|
|
|
|
void Draw(Texture2D& texture, Rectangle const& destinationRectangle, Rectangle const* sourceRectangle, Color const& color);
|
|
|
|
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(SpriteFont& spriteFont, String const& text, Vector2 const& position, Color const& color);
|
|
|
|
void DrawString(SpriteFont& spriteFont, String const& text, Vector2 const& position, Color const& color,
|
|
|
|
float rotation, Vector2 const& origin, float scale, SpriteEffects effects, float layerDepth);
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct PlatformImplementation;
|
|
|
|
uptr<PlatformImplementation> implementation = nullptr;
|
2024-04-14 16:11:15 -03:00
|
|
|
};
|
2024-05-18 21:14:56 -03:00
|
|
|
|
|
|
|
class SpriteFont {
|
|
|
|
public:
|
|
|
|
SpriteFont(GraphicsDevice& device, String const& fontFileName);
|
|
|
|
~SpriteFont();
|
|
|
|
Vector2 MeasureString(String const& text, bool ignoreWhiteSpace = true);
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct PlatformImplementation;
|
|
|
|
uptr<PlatformImplementation> implementation = nullptr;
|
|
|
|
};
|
2024-04-14 16:11:15 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|