7#include <aegis2d/render/export.hpp>
54 Rect source{.
x = 0.0F, .y = 0.0F, .width = 1.0F, .height = 1.0F};
130 [[nodiscard]]
virtual bool in_frame() const noexcept = 0;
140 virtual
void set_camera(const
std::optional<
Camera>& camera) = 0;
144 [[nodiscard]] virtual const
std::optional<
Camera>& camera() const noexcept = 0;
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
virtual TextureSize texture_size(TextureId texture) const =0
Size of a texture.
virtual void update_texture(TextureId texture, const Image &image)=0
Replaces the image of a texture, which keeps its identifier.
virtual void end_frame()=0
Finishes the current frame and shows it.
IRenderer & operator=(IRenderer &&)=delete
virtual bool in_frame() const noexcept=0
Tells whether a frame is started.
virtual void begin_frame(Color clear)=0
Starts a frame and fills the screen with one color.
virtual void draw(const Sprite &sprite)=0
Adds a sprite to the current frame.
IRenderer(const IRenderer &)=delete
IRenderer(IRenderer &&)=delete
virtual ~IRenderer()
Releases the backend resources.
IRenderer & operator=(const IRenderer &)=delete
virtual TextureId create_texture(const Image &image)=0
Makes a texture of an image, to draw sprites with.
RGBA color used by the renderer.
Images in memory: loaded from files, generated by the engine, saved as PNG.
Vector and matrix types of the engine (GLM behind engine names).
OpenGL renderer: sprites, text and camera (client only).
Definition bitmap_font.hpp:16
aegis2d::Vec2 Vec2
2D vector of floats, in logical pixels: the engine-wide aegis2d::Vec2.
Definition renderer.hpp:17
constexpr TextureId no_texture
Texture identifier meaning "no texture": the sprite is a plain tinted rectangle.
Definition renderer.hpp:35
std::uint32_t TextureId
Identifier of a texture loaded by the resource manager.
Definition renderer.hpp:32
glm::vec2 Vec2
2D vector of floats: positions, velocities, sizes (glm::vec2).
Definition math.hpp:19
Definition endpoint.hpp:85
RGBA color with components in [0, 1].
Definition color.hpp:10
float r
Red component.
Definition color.hpp:12
Counters of the last finished frame.
Definition renderer.hpp:64
std::size_t sprites
Sprites submitted with IRenderer::draw().
Definition renderer.hpp:66
std::size_t draw_calls
Draw calls sent to the graphics API.
Definition renderer.hpp:68
RGBA image with 8 bits per channel, ready to become a texture.
Definition image.hpp:25
Axis-aligned rectangle.
Definition renderer.hpp:20
float x
Left edge.
Definition renderer.hpp:22
float width
Width, positive.
Definition renderer.hpp:26
float y
Top edge.
Definition renderer.hpp:24
float height
Height, positive.
Definition renderer.hpp:28
One textured quad to draw.
Definition renderer.hpp:46
std::int32_t layer
Drawing order: higher layers are drawn over lower ones.
Definition renderer.hpp:58
Rect source
Part of the texture to sample, in normalized texture coordinates.
Definition renderer.hpp:54
Vec2 position
Top-left corner on screen.
Definition renderer.hpp:50
TextureId texture
Texture to sample, or no_texture for a plain rectangle.
Definition renderer.hpp:48
Vec2 size
Size on screen.
Definition renderer.hpp:52
Color tint
Color multiplied with the texture; opaque white keeps it unchanged.
Definition renderer.hpp:56
Width and height of a texture, in pixels.
Definition renderer.hpp:38
int width
Width in pixels.
Definition renderer.hpp:40
int height
Height in pixels.
Definition renderer.hpp:42