Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
sprite.h
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2025-2026 Manuel Osorio
3#pragma once
4#include "flint/graphics/gpu/gpu-texture.h"
5#include "flint/ui/ui-node.h"
6
7namespace Flint {
8
16 class UISprite : public UINode {
17 public:
18 UISprite() = default;
19
22 explicit UISprite(GPUTexture &texture);
23 ~UISprite() override = default;
24
25 void setTexture(GPUTexture &texture);
26
27 void measure(UIConstraints constraints) override;
28 void arrange(const Rect<float> &rect) override;
29 void render(UICanvas &canvas) const override;
30
31 private:
32 GPUTexture *m_texture = nullptr;
33 };
34
35}
Owns an SDL GPU texture and its associated sampler.
Definition gpu-texture.h:20
Dynamic 2D batching engine processing shape vector geometry and hardware-accelerated text strings....
Definition ui-canvas.h:106
Abstract base class for all UI widgets, managing hierarchy tracking, layout passes,...
Definition ui-node.h:30
void arrange(const Rect< float > &rect) override
Pass 2 of the layout engine: Evaluates layout adjustments to pin final screen coordinate values to th...
void render(UICanvas &canvas) const override
Pushes current styling rules and geometries straight down to the active pipeline vertex drawing queue...
void measure(UIConstraints constraints) override
Pass 1 of the layout engine: Crawls branches recursively to compute base display boundaries requested...
A static texture rendering frame component wrapper.
Definition sprite.h:16
UISprite(GPUTexture &texture)
Hooks the sprite wrapper directly to a non-owning raw handle texture resource asset.
Generic axis-aligned rectangle defined by a position and size.
Definition types.h:87
Represents the boundary budget passed down the node tree during layout allocation.
Definition ui-types.h:76