This commit is contained in:
Jorijn van der Graaf 2025-12-21 19:52:41 +01:00
commit c9fadb3779
5 changed files with 214 additions and 4 deletions

View file

@ -70,4 +70,25 @@ export namespace Crafter {
void UpdatePosition(Window& window) override;
void UpdatePosition(Window& window, Transform& parent) override;
};
class RenderingElementScalingRotating2D : public RenderingElement {
public:
std::vector<Pixel_BU8_GU8_RU8_AU8> buffer;
std::uint_fast32_t bufferWidth;
std::uint_fast32_t bufferHeight;
std::uint_fast32_t rotation;
bool rotationUpdated = true;
RenderingElementScalingRotating2D(OpaqueType opaque = OpaqueType::Transparent);
RenderingElementScalingRotating2D(OpaqueType opaque, 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);
RenderingElementScalingRotating2D(OpaqueType opaque, std::uint_fast32_t bufferWidth, std::uint_fast32_t bufferHeight, std::uint_fast32_t rotationAngle = 0, double scaleX = 1.0, double scaleY = 1.0, 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);
RenderingElementScalingRotating2D(RenderingElementScalingRotating2D&) = delete;
RenderingElementScalingRotating2D& operator=(RenderingElementScalingRotating2D&) = delete;
void UpdateRotation(std::uint_fast32_t newRotation);
void ResizeBuffer(std::uint_fast32_t width, std::uint_fast32_t height);
void UpdateScaledBuffer(ScaleData& data);
void UpdatePosition(Window& window) override;
void UpdatePosition(Window& window, Transform& parent) override;
};
}