diff options
Diffstat (limited to 'src/crepe/facade')
-rw-r--r-- | src/crepe/facade/SDLContext.cpp | 12 | ||||
-rw-r--r-- | src/crepe/facade/SDLContext.h | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/crepe/facade/SDLContext.cpp b/src/crepe/facade/SDLContext.cpp index bbeb3a9..9a2d15a 100644 --- a/src/crepe/facade/SDLContext.cpp +++ b/src/crepe/facade/SDLContext.cpp @@ -98,11 +98,11 @@ void SDLContext::handle_events(bool & running) { */ } -void SDLContext::clear_screen() { SDL_RenderClear(this->game_renderer); } -void SDLContext::present_screen() { SDL_RenderPresent(this->game_renderer); } +void SDLContext::clear_screen() const { SDL_RenderClear(this->game_renderer); } +void SDLContext::present_screen() const { SDL_RenderPresent(this->game_renderer); } void SDLContext::draw(const Sprite & sprite, const Transform & transform, - const Camera & cam) { + const Camera & cam) const { static SDL_RendererFlip render_flip = (SDL_RendererFlip) ((SDL_FLIP_HORIZONTAL * sprite.flip.flip_x) @@ -147,7 +147,7 @@ void SDLContext::camera(const Camera & cam) { const uint64_t SDLContext::get_ticks() const { return SDL_GetTicks64(); } -SDL_Texture * SDLContext::texture_from_path(const char * path) { +SDL_Texture * SDLContext::texture_from_path(const char * path) const { dbg_trace(); SDL_Surface * tmp = IMG_Load(path); @@ -165,12 +165,12 @@ SDL_Texture * SDLContext::texture_from_path(const char * path) { return created_texture; } -int SDLContext::get_width(const Texture & ctx) { +int SDLContext::get_width(const Texture & ctx) const { int w; SDL_QueryTexture(ctx.texture, NULL, NULL, &w, NULL); return w; } -int SDLContext::get_height(const Texture & ctx) { +int SDLContext::get_height(const Texture & ctx) const { int h; SDL_QueryTexture(ctx.texture, NULL, NULL, NULL, &h); return h; diff --git a/src/crepe/facade/SDLContext.h b/src/crepe/facade/SDLContext.h index a08d0d8..3396697 100644 --- a/src/crepe/facade/SDLContext.h +++ b/src/crepe/facade/SDLContext.h @@ -101,21 +101,21 @@ private: * \param path Path to the image file. * \return Pointer to the created SDL_Texture. */ - SDL_Texture * texture_from_path(const char * path); + SDL_Texture * texture_from_path(const char * path) const; /** * \brief Gets the width of a texture. * \param texture Reference to the Texture object. * \return Width of the texture as an integer. */ - int get_width(const Texture & ); + int get_width(const Texture & ) const ; /** * \brief Gets the height of a texture. * \param texture Reference to the Texture object. * \return Height of the texture as an integer. */ - int get_height(const Texture &); + int get_height(const Texture &) const ; private: @@ -129,17 +129,17 @@ private: * \param camera Reference to the Camera for view adjustments. */ void draw(const Sprite & sprite, const Transform & transform, - const Camera & camera); + const Camera & camera) const; /** * \brief Clears the screen, preparing for a new frame. */ - void clear_screen(); + void clear_screen() const ; /** * \brief Presents the rendered frame to the screen. */ - void present_screen(); + void present_screen() const ; /** * \brief Sets the current camera for rendering. |