From 5b0a178b3362aeb4f0a2c35e1dea71c72bca0b6e Mon Sep 17 00:00:00 2001 From: Le Juez Victor <90587919+Bigfoot71@users.noreply.github.com> Date: Tue, 10 Oct 2023 13:10:11 +0200 Subject: [PATCH] Added `const` to member functions where possible --- include/AudioStream.hpp | 2 +- include/Font.hpp | 2 +- include/Material.hpp | 2 +- include/Rectangle.hpp | 6 +++--- include/Text.hpp | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/AudioStream.hpp b/include/AudioStream.hpp index c018ea5e..a47a2a94 100644 --- a/include/AudioStream.hpp +++ b/include/AudioStream.hpp @@ -194,7 +194,7 @@ class AudioStream : public ::AudioStream { /** * Retrieve whether or not the audio stream is ready. */ - bool IsReady() { + bool IsReady() const { return ::IsAudioStreamReady(*this); } diff --git a/include/Font.hpp b/include/Font.hpp index 3b49596c..be97d718 100644 --- a/include/Font.hpp +++ b/include/Font.hpp @@ -206,7 +206,7 @@ class Font : public ::Font { /** * Returns if the font is ready to be used. */ - bool IsReady() { + bool IsReady() const { return ::IsFontReady(*this); } diff --git a/include/Material.hpp b/include/Material.hpp index e7c66fac..c9771061 100644 --- a/include/Material.hpp +++ b/include/Material.hpp @@ -112,7 +112,7 @@ class Material : public ::Material { /** * Check if material is ready */ - inline bool IsReady() { + inline bool IsReady() const { return ::IsMaterialReady(*this); } diff --git a/include/Rectangle.hpp b/include/Rectangle.hpp index 661b1be0..08d208d1 100644 --- a/include/Rectangle.hpp +++ b/include/Rectangle.hpp @@ -109,11 +109,11 @@ class Rectangle : public ::Rectangle { /** * Check collision between circle and rectangle */ - inline bool CheckCollision(::Vector2 center, float radius) { + inline bool CheckCollision(::Vector2 center, float radius) const { return ::CheckCollisionCircleRec(center, radius, *this); } - inline Vector2 GetSize() { + inline Vector2 GetSize() const { return {width, height}; } @@ -132,7 +132,7 @@ class Rectangle : public ::Rectangle { return *this; } - inline Vector2 GetPosition() { + inline Vector2 GetPosition() const { return {x, y}; } diff --git a/include/Text.hpp b/include/Text.hpp index eba0a151..7e791f51 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -121,14 +121,14 @@ class Text { /** * Measure string width for default font */ - inline int Measure() { + inline int Measure() const { return ::MeasureText(text.c_str(), static_cast(fontSize)); } /** * Measure string size for Font */ - inline Vector2 MeasureEx() { + inline Vector2 MeasureEx() const { return ::MeasureTextEx(font, text.c_str(), fontSize, spacing); }