Skip to content

Commit

Permalink
BLUGA-GRAPHICS: Fix
Browse files Browse the repository at this point in the history
MAJOR
  • Loading branch information
Saverio976 committed Nov 2, 2023
1 parent ca412f6 commit c70de53
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ namespace Raylib {

TextureManager &TextureManager::getInstance()
{
static TextureManagerImpl instance;
return instance;
return TextureManagerImpl::getInstance();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -315,5 +315,9 @@ namespace Raylib {
[[nodiscard]] virtual Color getColor() const = 0;

virtual void setCurrentFontSize(float fontSize) = 0;

[[nodiscard]] virtual const std::string &getCurrentText() const = 0;

virtual void setCurrentText(const std::string &text) = 0;
};
} // namespace Raylib
11 changes: 8 additions & 3 deletions libs/B-luga-graphics/src/RaylibImpl/Graphics/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@ namespace Raylib {
return _image.data;
}

TextureManagerImpl &TextureManagerImpl::getInstance()
{
static TextureManagerImpl instance;
return instance;
}

SpriteImpl::SpriteImpl(const std::string &fileName, float width, float height, std::size_t id)
: _texture(TextureManager::getInstance().getTexture(fileName)),
: _texture(TextureManagerImpl::getInstance().getTexture(fileName)),
_width(width),
_height(height)
{
Expand Down Expand Up @@ -288,12 +293,12 @@ namespace Raylib {
_currentFontSize = fontSize;
}

std::string &Text::getCurrentText()
const std::string &TextImpl::getCurrentText()
{
return (_text);
}

void Text::setCurrentText(const std::string &text)
void TextImpl::setCurrentText(const std::string &text)
{
_text = text;
}
Expand Down
5 changes: 5 additions & 0 deletions libs/B-luga-graphics/src/RaylibImpl/Graphics/Graphics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace Raylib {

class TextureManagerImpl : public TextureManager {
public:
static TextureManagerImpl &getInstance();
::Texture2D &getTexture(const std::string &fileName);
void unloadTextures() override;

Expand Down Expand Up @@ -129,6 +130,10 @@ namespace Raylib {

void setCurrentFontSize(float fontSize) override;

[[nodiscard]] const std::string &getCurrentText() const override;

void setCurrentText(const std::string &text) override;

private:
std::string _text;
float _fontSize;
Expand Down

0 comments on commit c70de53

Please sign in to comment.