diff options
author | Frederico Linhares <fred@linhares.blue> | 2024-12-30 23:25:24 -0300 |
---|---|---|
committer | Frederico Linhares <fred@linhares.blue> | 2024-12-30 23:25:24 -0300 |
commit | 083e64da1d4b5b68579288bc1690ca90d3f0a2c0 (patch) | |
tree | e2cbf364bc02e76f4a6065e35c3c8a6399389df3 | |
parent | 46c1f83aa6ba6216fb2fe83dac7612224d19b5aa (diff) |
refa Using reference arguments for Texture and Sprite
-rw-r--r-- | src/blucat/sprite.cpp | 8 | ||||
-rw-r--r-- | src/blucat/sprite.hpp | 2 | ||||
-rw-r--r-- | src/blucat/texture.cpp | 7 | ||||
-rw-r--r-- | src/blucat/texture.hpp | 2 |
4 files changed, 10 insertions, 9 deletions
diff --git a/src/blucat/sprite.cpp b/src/blucat/sprite.cpp index 506d87a..0c66a27 100644 --- a/src/blucat/sprite.cpp +++ b/src/blucat/sprite.cpp @@ -28,12 +28,12 @@ namespace struct SpriteBuilder { BluCat::Sprite *sprite; - glm::vec4 ▭ + const glm::vec4 ▭ - SpriteBuilder(BluCat::Sprite *sprite, glm::vec4 &rect); + SpriteBuilder(BluCat::Sprite *sprite, const glm::vec4 &rect); }; -SpriteBuilder::SpriteBuilder(BluCat::Sprite *sprite, glm::vec4 &rect): +SpriteBuilder::SpriteBuilder(BluCat::Sprite *sprite, const glm::vec4 &rect): sprite{sprite}, rect{rect} { @@ -82,7 +82,7 @@ static const CommandChain loader{ namespace BluCat { -Sprite::Sprite(std::shared_ptr<Texture> texture, glm::vec4 &rect): +Sprite::Sprite(std::shared_ptr<Texture> texture, const glm::vec4 &rect): texture{texture} { SpriteBuilder sprite_builder(this, rect); diff --git a/src/blucat/sprite.hpp b/src/blucat/sprite.hpp index 68b6420..303beca 100644 --- a/src/blucat/sprite.hpp +++ b/src/blucat/sprite.hpp @@ -41,7 +41,7 @@ struct Sprite std::shared_ptr<Texture> texture; - Sprite(std::shared_ptr<Texture> texture, glm::vec4 &rect); + Sprite(std::shared_ptr<Texture> texture, const glm::vec4 &rect); ~Sprite(); }; diff --git a/src/blucat/texture.cpp b/src/blucat/texture.cpp index 4c94945..afab950 100644 --- a/src/blucat/texture.cpp +++ b/src/blucat/texture.cpp @@ -55,11 +55,12 @@ struct ImageTextureBuilder: public ImageBuilder { std::string texture_path; - ImageTextureBuilder(BluCat::Texture *t, std::string tp); + ImageTextureBuilder(BluCat::Texture *t, const std::string &tp); ImageTextureBuilder(BluCat::Texture *t, const char* tp); }; -ImageTextureBuilder::ImageTextureBuilder(BluCat::Texture *t, std::string tp): +ImageTextureBuilder::ImageTextureBuilder( + BluCat::Texture *t, const std::string &tp): texture_path{tp} { this->texture = t; @@ -539,7 +540,7 @@ Texture::Texture(Font *font, const char* str) descriptor_loader.execute(this); } -Texture::Texture(std::string texture_path) +Texture::Texture(const std::string &texture_path) { this->queue_family = BluCat::core.vk_device_with_swapchain-> diff --git a/src/blucat/texture.hpp b/src/blucat/texture.hpp index 5d076dc..4bf0350 100644 --- a/src/blucat/texture.hpp +++ b/src/blucat/texture.hpp @@ -41,7 +41,7 @@ struct Texture std::vector<VkDescriptorSet> descriptor_sets; Texture(Font *font, const char *str); - Texture(std::string texture_path); + Texture(const std::string &texture_path); Texture(const char* texture_path); ~Texture(); }; |