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
5#include "flint/core/api.h"
6#include "flint/graphics/gpu/gpu-texture.h"
7#include "flint/ui/ui-node.h"
8
9namespace Flint {
10
18 class UISprite : public UINode {
19 public:
20 UISprite() = default;
21
24 FLINT_API explicit UISprite(GPUTexture &texture);
25 ~UISprite() override = default;
26
27 FLINT_API void setTexture(GPUTexture &texture);
28
29 FLINT_API void measure(UIConstraints constraints) override;
30 FLINT_API void arrange(const Rect<float> &rect) override;
31 FLINT_API void render(UICanvas &canvas) const override;
32
33 private:
34 GPUTexture *m_texture = nullptr;
35 };
36
37}
Owns an SDL GPU texture and its associated sampler.
Definition gpu-texture.h:21
Dynamic 2D batching engine processing shape vector geometry and hardware-accelerated text strings....
Definition ui-canvas.h:107
Abstract base class for all UI widgets, managing hierarchy tracking, layout passes,...
Definition ui-node.h:31
A static texture rendering frame component wrapper.
Definition sprite.h:18
FLINT_API void arrange(const Rect< float > &rect) override
Pass 2 of the layout engine: Evaluates layout adjustments to pin final screen coordinate values to th...
FLINT_API void render(UICanvas &canvas) const override
Pushes current styling rules and geometries straight down to the active pipeline vertex drawing queue...
FLINT_API UISprite(GPUTexture &texture)
Hooks the sprite wrapper directly to a non-owning raw handle texture resource asset.
FLINT_API void measure(UIConstraints constraints) override
Pass 1 of the layout engine: Crawls branches recursively to compute base display boundaries requested...
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