text changes
This commit is contained in:
parent
627ef13727
commit
d5ee272290
6 changed files with 135 additions and 54 deletions
|
|
@ -23,7 +23,7 @@ import :RenderingElement;
|
|||
import :Types;
|
||||
|
||||
export namespace Crafter {
|
||||
class ImageElement : public RenderingElement {
|
||||
class ImageElement : public RenderingElementScaling {
|
||||
public:
|
||||
ImageElement();
|
||||
ImageElement(const std::string_view imagePath, std::int_fast32_t anchorX = FractionalToMapped(0.5), std::int_fast32_t anchorY = FractionalToMapped(0.5), std::uint_fast32_t relativeWidth = FractionalToMapped(1), std::uint_fast32_t relativeHeight = FractionalToMapped(1), std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
|
||||
|
|
|
|||
|
|
@ -24,20 +24,41 @@ import :Types;
|
|||
|
||||
export namespace Crafter {
|
||||
class Window;
|
||||
class Font;
|
||||
class RenderingElement : public Transform {
|
||||
public:
|
||||
std::vector<Pixel_BU8_GU8_RU8_AU8> buffer;
|
||||
std::vector<Pixel_BU8_GU8_RU8_AU8> bufferScaled;
|
||||
std::uint_fast32_t bufferWidth;
|
||||
std::uint_fast32_t bufferHeight;
|
||||
bool opaque = false;
|
||||
|
||||
RenderingElement(bool opague = false);
|
||||
RenderingElement(bool opague, std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX, std::int_fast32_t anchorOffsetY, std::int_fast32_t z, bool ignoreScaling);
|
||||
RenderingElement(bool opague, std::uint_fast32_t bufferWidth, std::uint_fast32_t bufferHeight, std::int_fast32_t anchorX = FractionalToMapped(0.5), std::int_fast32_t anchorY = FractionalToMapped(0.5), std::uint_fast32_t relativeWidth = FractionalToMapped(1), std::uint_fast32_t relativeHeight = FractionalToMapped(1), std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
|
||||
RenderingElement(RenderingElement&) = delete;
|
||||
RenderingElement& operator=(RenderingElement&) = delete;
|
||||
};
|
||||
|
||||
class RenderingElementPreScaled : public RenderingElement {
|
||||
public:
|
||||
RenderingElementPreScaled(bool opague = false);
|
||||
RenderingElementPreScaled(bool opague, std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX, std::int_fast32_t anchorOffsetY, std::int_fast32_t z, bool ignoreScaling);
|
||||
RenderingElementPreScaled(RenderingElementPreScaled&) = delete;
|
||||
RenderingElementPreScaled& operator=(RenderingElementPreScaled&) = delete;
|
||||
|
||||
void CopyNearestNeighbour(Pixel_BU8_GU8_RU8_AU8* dst, std::uint_fast32_t dstWidth, std::uint_fast32_t dstHeight) const;
|
||||
void UpdatePosition(Window& window) override;
|
||||
void UpdatePosition(Window& window, Transform& parent) override;
|
||||
};
|
||||
|
||||
class RenderingElementScaling: public RenderingElement {
|
||||
public:
|
||||
std::vector<Pixel_BU8_GU8_RU8_AU8> buffer;
|
||||
std::uint_fast32_t bufferWidth;
|
||||
std::uint_fast32_t bufferHeight;
|
||||
bool opaque = false;
|
||||
|
||||
RenderingElementScaling(bool opague = false);
|
||||
RenderingElementScaling(bool opague, std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX, std::int_fast32_t anchorOffsetY, std::int_fast32_t z, bool ignoreScaling);
|
||||
RenderingElementScaling(bool opague, std::uint_fast32_t bufferWidth, std::uint_fast32_t bufferHeight, std::int_fast32_t anchorX = FractionalToMapped(0.5), std::int_fast32_t anchorY = FractionalToMapped(0.5), std::uint_fast32_t relativeWidth = FractionalToMapped(1), std::uint_fast32_t relativeHeight = FractionalToMapped(1), std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
|
||||
RenderingElementScaling(RenderingElementScaling&) = delete;
|
||||
RenderingElementScaling& operator=(RenderingElementScaling&) = delete;
|
||||
|
||||
void ResizeBuffer(std::uint_fast32_t width, std::uint_fast32_t height);
|
||||
void CopyNearestNeighbour(Pixel_BU8_GU8_RU8_AU8* dst, std::uint_fast32_t dstWidth, std::uint_fast32_t dstHeight) const;
|
||||
|
|
|
|||
|
|
@ -24,11 +24,9 @@ import :Types;
|
|||
import :Font;
|
||||
|
||||
export namespace Crafter {
|
||||
class TextElement : public RenderingElement {
|
||||
class TextElement : public RenderingElementPreScaled {
|
||||
public:
|
||||
TextElement();
|
||||
TextElement(const std::string_view text, float size, Pixel_BU8_GU8_RU8_AU8 pixel, Font& font, std::int_fast32_t anchorX = FractionalToMapped(0.5), std::int_fast32_t anchorY = FractionalToMapped(0.5), std::uint_fast32_t relativeWidth = FractionalToMapped(1), std::uint_fast32_t relativeHeight = FractionalToMapped(1), std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
|
||||
|
||||
TextElement(std::int_fast32_t anchorX = FractionalToMapped(0.5), std::int_fast32_t anchorY = FractionalToMapped(0.5), std::uint_fast32_t relativeWidth = FractionalToMapped(1), std::uint_fast32_t relativeHeight = FractionalToMapped(1), std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
|
||||
void RenderText(const std::string_view text, float size, Pixel_BU8_GU8_RU8_AU8 pixel, Font& font);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue