Implement Sprite class

This commit is contained in:
Lexi / Zoe 2025-11-30 00:37:44 +01:00
parent d4c91450d9
commit bb9d108102
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
7 changed files with 132 additions and 56 deletions

View file

@ -43,13 +43,21 @@ export namespace core
}
/**
* Loads a texture from a file (if not loaded yet) and returns its texture ID.
* Load a texture from a file (if not loaded yet) and return its texture ID.
*/
constexpr TextureID load_texture(const std::string& filename)
{
return texture_manager_.load_resource_by_name(filename);
}
/**
* Get a reference to a texture by its texture ID.
*/
constexpr const sdl::Texture& get_texture(const TextureID texture_id) const
{
return texture_manager_.get_resource(texture_id);
}
void start_frame() const
{
renderer_.clear();
@ -60,16 +68,16 @@ export namespace core
renderer_.present();
}
constexpr void render_texture(
void render_texture(
const TextureID texture_id,
const sdl::FRect* src_rect,
const sdl::FRect* dest_rect
) const
{
render_texture(texture_manager_.get_resource(texture_id), src_rect, dest_rect);
render_texture(get_texture(texture_id), src_rect, dest_rect);
}
void render_texture(
constexpr void render_texture(
const sdl::Texture& texture,
const sdl::FRect* src_rect,
const sdl::FRect* dest_rect