@@ -20,9 +20,9 @@ Text::Text(const std::string &font, int fontSize, const std::string &text,
2020 if (s_VertexArray == nullptr ) {
2121 InitVertexArray ();
2222 }
23- if (s_UniformBuffer == nullptr ) {
24- InitUniformBuffer ();
25- }
23+
24+ m_UniformBuffer = std::make_unique<Core::UniformBuffer<Core::Matrices>>(
25+ *s_Program, " Matrices " , 0 );
2626
2727 m_Font = {TTF_OpenFont (font.c_str (), fontSize), TTF_CloseFont};
2828
@@ -45,7 +45,7 @@ Text::Text(const std::string &font, int fontSize, const std::string &text,
4545}
4646
4747void Text::Draw (const Core::Matrices &data) {
48- s_UniformBuffer ->SetData (0 , data);
48+ m_UniformBuffer ->SetData (0 , data);
4949
5050 m_Texture->Bind (UNIFORM_SURFACE_LOCATION);
5151 s_Program->Bind ();
@@ -101,11 +101,6 @@ void Text::InitVertexArray() {
101101 // NOLINTEND
102102}
103103
104- void Text::InitUniformBuffer () {
105- s_UniformBuffer = std::make_unique<Core::UniformBuffer<Core::Matrices>>(
106- *s_Program, " Matrices" , 0 );
107- }
108-
109104void Text::ApplyTexture () {
110105 auto surface =
111106 std::unique_ptr<SDL_Surface, std::function<void (SDL_Surface *)>>{
@@ -125,7 +120,5 @@ void Text::ApplyTexture() {
125120
126121std::unique_ptr<Core::Program> Text::s_Program = nullptr ;
127122std::unique_ptr<Core::VertexArray> Text::s_VertexArray = nullptr ;
128- std::unique_ptr<Core::UniformBuffer<Core::Matrices>> Text::s_UniformBuffer =
129- nullptr ;
130123
131124} // namespace Util
0 commit comments