aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp51
1 files changed, 20 insertions, 31 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
index 7cf7686..e16c15c 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -377,21 +377,13 @@ namespace ui {
if (pageTexReady) {
- GLfloat page_loc[] = {offset.x - 300, SCREEN_HEIGHT - 100, -6.0,
- offset.x + 300, SCREEN_HEIGHT - 100, -6.0,
- offset.x + 300, SCREEN_HEIGHT - 600, -6.0,
-
- offset.x + 300, SCREEN_HEIGHT - 600, -6.0,
- offset.x - 300, SCREEN_HEIGHT - 600, -6.0,
- offset.x - 300, SCREEN_HEIGHT - 100, -6.0};
-
- static const GLfloat page_tex[] = {
- 0.0, 0.0,
- 1.0, 0.0,
- 1.0, 1.0,
- 1.0, 1.0,
- 0.0, 1.0,
- 0.0, 0.0
+ GLfloat page_verts[] = {
+ offset.x - 300, SCREEN_HEIGHT - 100, -6.0, 0, 0,
+ offset.x + 300, SCREEN_HEIGHT - 100, -6.0, 1, 0,
+ offset.x + 300, SCREEN_HEIGHT - 600, -6.0, 1, 1,
+ offset.x + 300, SCREEN_HEIGHT - 600, -6.0, 1, 1,
+ offset.x - 300, SCREEN_HEIGHT - 600, -6.0, 0, 1,
+ offset.x - 300, SCREEN_HEIGHT - 100, -6.0, 0, 0,
};
glActiveTexture(GL_TEXTURE0);
@@ -401,8 +393,8 @@ namespace ui {
Render::textShader.use();
Render::textShader.enable();
- glVertexAttribPointer(Render::textShader.coord, 3, GL_FLOAT, GL_FALSE, 0, page_loc);
- glVertexAttribPointer(Render::textShader.tex, 2, GL_FLOAT, GL_FALSE, 0, page_tex);
+ glVertexAttribPointer(Render::textShader.coord, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), page_verts);
+ glVertexAttribPointer(Render::textShader.tex, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), page_verts + 3);
glDrawArrays(GL_TRIANGLES, 0 ,6);
Render::textShader.disable();
@@ -938,20 +930,16 @@ void UISystem::render(void)
fadeIntensity = 255;
if (fadeIntensity != 0) {
- static const GLfloat tex[12] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
-
vec2 p1 (offset.x - game::SCREEN_WIDTH / 2, offset.y - game::SCREEN_HEIGHT / 2);
vec2 p2 (p1.x + game::SCREEN_WIDTH, p1.y + game::SCREEN_HEIGHT);
- GLfloat backdrop[18] = {
- p1.x, p1.y, -7.9,
- p2.x, p1.y, -7.9,
- p2.x, p2.y, -7.9,
-
- p2.x, p2.y, -7.9,
- p1.x, p2.y, -7.9,
- p1.x, p1.y, -7.9
+
+ GLfloat backdrop[] = {
+ p1.x, p1.y, -7.9, 0, 0,
+ p2.x, p1.y, -7.9, 0, 0,
+ p2.x, p2.y, -7.9, 0, 0,
+ p2.x, p2.y, -7.9, 0, 0,
+ p1.x, p2.y, -7.9, 0, 0,
+ p1.x, p1.y, -7.9, 0, 0,
};
Render::textShader.use();
@@ -959,8 +947,8 @@ void UISystem::render(void)
Colors::black.use();
glUniform4f(Render::textShader.uniform[WU_tex_color], 1.0f, 1.0f, 1.0f, fadeIntensity / 255.0f);
- glVertexAttribPointer(Render::textShader.coord, 3, GL_FLOAT, GL_FALSE, 0, backdrop);
- glVertexAttribPointer(Render::textShader.tex, 2, GL_FLOAT, GL_FALSE, 0, tex);
+ glVertexAttribPointer(Render::textShader.coord, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), backdrop);
+ glVertexAttribPointer(Render::textShader.tex, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), backdrop + 3);
glDrawArrays(GL_TRIANGLES, 0, 6);
Render::textShader.disable();
@@ -971,6 +959,7 @@ void UISystem::render(void)
if (!dialogText.empty()) {
vec2 where (offset.x - 300, game::SCREEN_HEIGHT - 60);
ui::drawNiceBox(vec2(where.x - 10, where.y - 200), vec2(where.x + 620, where.y + 20), -5.5f);
+ FontSystem::setFontZ(-6.0f);
putString(where, ui::typeOut(dialogText), where.x + 600);
if (!dialogOptions.empty()) {