[FEATURE] working gui buttons

This commit is contained in:
Menno
2021-05-25 14:38:35 +02:00
parent 21a7f4f4b2
commit 977d377fe5
9 changed files with 197 additions and 35 deletions

View File

@@ -82,7 +82,7 @@ namespace render_engine
glBindVertexArray(0);
}
void Render(std::vector<gui::GuiTexture>& guis, shaders::GuiShader& shader)
void Render(std::vector<gui::GuiTexture*>& guis, shaders::GuiShader& shader)
{
shader.Start();
@@ -98,13 +98,13 @@ namespace render_engine
glDisable(GL_DEPTH_TEST);
// Render each gui to the screen
for (gui::GuiTexture& gui : guis)
{
for (gui::GuiTexture* gui : guis)
{
// Bind the texture of the gui to the shader
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, gui.texture);
glBindTexture(GL_TEXTURE_2D, gui->texture);
glm::mat4 matrix = toolbox::CreateModelMatrix(gui.position, gui.scale);
glm::mat4 matrix = toolbox::CreateModelMatrix(gui->position, gui->scale);
shader.LoadModelMatrix(matrix);
glDrawArrays(GL_TRIANGLE_STRIP, 0, quad.vertex_count);

View File

@@ -1,6 +1,6 @@
#pragma once
#include "../gui/gui_texture.h"
#include "../gui/gui_element.h"
#include "../entities/entity.h"
#include "../shaders/entity_shader.h"
#include "../shaders/gui_shader.h"
@@ -38,6 +38,6 @@ namespace render_engine
@param guis: A list with all the GUI textures you want to render
@param shade: The shader the GUI textures need to be rendered with
*/
void Render(std::vector<gui::GuiTexture>& guis, shaders::GuiShader& shader);
void Render(std::vector<gui::GuiTexture*>& guis, shaders::GuiShader& shader);
}
}