@@ -39,11 +39,12 @@ Text::Text(const std::string &font, int size, const std::string &text) {
3939 m_Surface->format ->BytesPerPixel ,
4040 m_Surface->pitch / m_Surface->format ->BytesPerPixel , m_Surface->h ,
4141 m_Surface->pixels );
42+ m_Size = {m_Surface->pitch / m_Surface->format ->BytesPerPixel ,
43+ m_Surface->h };
4244}
4345
4446void Text::Draw (const Util::Transform &transform, const float zIndex) {
45- // FIXME: temporary fix
46- auto data = Util::ConvertToUniformBufferData (transform, zIndex);
47+ auto data = Util::ConvertToUniformBufferData (transform, m_Size, zIndex);
4748 s_UniformBuffer->SetData (0 , data);
4849
4950 m_Texture->Bind (UNIFORM_SURFACE_LOCATION);
@@ -67,20 +68,17 @@ void Text::InitProgram() {
6768void Text::InitVertexArray () {
6869 s_VertexArray = std::make_unique<Core::VertexArray>();
6970
70- // hard coded value
71- constexpr float scale = 100 .0F ;
72-
7371 // NOLINTBEGIN
7472 // These are vertex data for the rectangle but clang-tidy has magic
7573 // number warnings
7674
7775 // Vertex
7876 s_VertexArray->AddVertexBuffer (std::make_unique<Core::VertexBuffer>(
7977 std::vector<float >{
80- -1 . 0F * scale, 1 . 0F * scale , //
81- -1 . 0F * scale , -1 . 0F * scale , //
82- 1 . 0F * scale , -1 . 0F * scale , //
83- 1 . 0F * scale, 1 . 0F * scale , //
78+ -0 . 5F , 0 . 5F , //
79+ -0 . 5F , -0 . 5F , //
80+ 0 . 5F , -0 . 5F , //
81+ 0 . 5F , 0 . 5F , //
8482 },
8583 2 ));
8684
@@ -103,13 +101,9 @@ void Text::InitVertexArray() {
103101 // NOLINTEND
104102}
105103
106- void Text::InitUniformBuffer (const Util::Transform &transform,
107- const float zIndex) {
104+ void Text::InitUniformBuffer () {
108105 s_UniformBuffer = std::make_unique<Core::UniformBuffer<Core::Matrices>>(
109106 *s_Program, " Matrices" , 0 );
110-
111- auto data = Util::ConvertToUniformBufferData (transform, zIndex);
112- s_UniformBuffer->SetData (0 , data);
113107}
114108
115109std::unique_ptr<Core::Program> Text::s_Program = nullptr ;
0 commit comments