9#include <aegis2d/render/export.hpp>
77 [[nodiscard]]
bool in_frame() const noexcept override;
79 [[nodiscard]]
FrameStats stats() const noexcept override;
81 void set_camera(const
std::optional<
Camera>& camera) override;
83 [[nodiscard]] const
std::optional<
Camera>& camera() const noexcept override;
132 void set_gpu_timing(
bool enabled);
137 [[nodiscard]]
std::optional<core::Duration> gpu_time() const noexcept;
141 [[nodiscard]] const
Context& context() const noexcept;
146 [[nodiscard]]
std::span<const
Sprite> pending() const noexcept;
151 void capture_next_frame() noexcept;
156 [[nodiscard]] const
std::optional<
Image>& captured() const noexcept;
161 std::reference_wrapper<const platform::Window> window_;
163 std::unique_ptr<Pipeline> pipeline_;
170 int frame_height_ = 0;
171 bool in_frame_ = false;
172 bool capture_ = false;
2D camera: the part of a world larger than the screen that is shown.
The part of the world shown on screen: where it looks, how close, within which bounds.
Definition camera.hpp:31
What the game draws with, whatever the graphics API behind it.
Definition renderer.hpp:81
OpenGL core profile context of a window, with every OpenGL function loaded.
Definition context.hpp:77
IRenderer drawing into a window with OpenGL.
Definition renderer.hpp:47
void update_texture(TextureId texture, const Image &image) override
Replaces the image of a texture, which keeps its identifier.
TextureId create_texture(const Image &image) override
Makes a texture of an image, to draw sprites with.
Renderer(Renderer &&)=delete
TextureSize texture_size(TextureId texture) const override
Size of a texture.
Renderer & operator=(const Renderer &)=delete
bool in_frame() const noexcept override
Tells whether a frame is started.
Renderer(const platform::Window &window, const ContextConfig &config={})
Creates the OpenGL context of window and the sprite pipeline.
~Renderer() override
Deletes the textures and buffers, then the context.
Renderer(const Renderer &)=delete
void end_frame() override
Finishes the current frame and shows it.
Renderer & operator=(Renderer &&)=delete
void draw(const Sprite &sprite) override
Adds a sprite to the current frame.
void begin_frame(Color clear) override
Starts a frame and fills the screen with one color.
Fixed-timestep accumulator and monotonic stopwatch.
RGBA color used by the renderer.
Images in memory: loaded from files, generated by the engine, saved as PNG.
A fixed logical screen scaled into a window of any size, keeping its aspect ratio.
OpenGL backend of the renderer.
Definition context.hpp:18
DrawMode
How end_frame() sends the sprites to the GPU.
Definition renderer.hpp:25
@ Naive
One upload, texture bind and draw call per sprite, in the same order: what a renderer without batchin...
@ Batched
The vertices of the whole frame sent at once, then one draw call per run of sprites sharing a layer a...
aegis2d::Vec2 Vec2
2D vector of floats, in logical pixels: the engine-wide aegis2d::Vec2.
Definition renderer.hpp:17
std::uint32_t TextureId
Identifier of a texture loaded by the resource manager.
Definition renderer.hpp:32
Definition endpoint.hpp:85
OpenGL core context attached to a window, with its functions loaded.
Backend-independent renderer interface and the sprite it draws.
RGBA color with components in [0, 1].
Definition color.hpp:10
Counters of the last finished frame.
Definition renderer.hpp:64
RGBA image with 8 bits per channel, ready to become a texture.
Definition image.hpp:25
Where the logical screen goes in the window's framebuffer.
Definition letterbox.hpp:38
The game's screen at a fixed size, whatever the window's.
Definition letterbox.hpp:28
One textured quad to draw.
Definition renderer.hpp:46
Width and height of a texture, in pixels.
Definition renderer.hpp:38
Settings of a new context.
Definition context.hpp:52
SDL3 desktop window with its events, keyboard, mouse and gamepads, independent of the graphics API.