aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-05-09 07:42:18 -0400
committerClyne Sullivan <tullivan99@gmail.com>2016-05-09 07:42:18 -0400
commit50bfb70e9a1788e6f64800001919e3d8386eb81d (patch)
tree2c41ac01a6212a9cd3c6d304e161b9e6d073e815 /src/entities.cpp
parentbc92962aff14805d5920f5a82628648d1c1fe4fd (diff)
world draw fixes
Diffstat (limited to 'src/entities.cpp')
-rw-r--r--src/entities.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/entities.cpp b/src/entities.cpp
index c4e4186..a8f5e48 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -435,38 +435,38 @@ if (health != maxHealth) {
};
GLfloat coord_front[] = {
- loc.x, loc.y + height, 1.0,
- loc.x + width, loc.y + height, 1.0,
- loc.x + width, loc.y + height + game::HLINE * 2, 1.0,
+ loc.x, loc.y + height, 1.0,
+ loc.x + health / maxHealth * width, loc.y + height, 1.0,
+ loc.x + health / maxHealth * width, loc.y + height + game::HLINE * 2, 1.0,
- loc.x + width, loc.y + height + game::HLINE * 2, 1.0,
- loc.x, loc.y + height + game::HLINE * 2, 1.0,
- loc.x, loc.y + height, 1.0,
+ loc.x + health / maxHealth * width, loc.y + height + game::HLINE * 2, 1.0,
+ loc.x, loc.y + height + game::HLINE * 2, 1.0,
+ loc.x, loc.y + height, 1.0,
};
- vec2 index = Texture::getIndex(Color(150,0,0));
+ static const vec2 index1 = Texture::getIndex(Color(0,0,0));
GLfloat back_tex[] = {
- float(.25*index.x), float(.125*index.y),
- float(.25*index.x), float(.125*index.y),
- float(.25*index.x), float(.125*index.y),
+ float(.25*index1.x), float(.125*index1.y),
+ float(.25*index1.x), float(.125*index1.y),
+ float(.25*index1.x), float(.125*index1.y),
- float(.25*index.x), float(.125*index.y),
- float(.25*index.x), float(.125*index.y),
- float(.25*index.x), float(.125*index.y),
+ float(.25*index1.x), float(.125*index1.y),
+ float(.25*index1.x), float(.125*index1.y),
+ float(.25*index1.x), float(.125*index1.y),
};
glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, coord_back);
glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, back_tex);
glDrawArrays(GL_TRIANGLES, 0, 6);
- index = Texture::getIndex(Color(255,0,0));
+ static const vec2 index2 = Texture::getIndex(Color(255,0,0));
GLfloat front_tex[] = {
- float(.25*index.x), float(.125*index.y),
- float(.25*index.x), float(.125*index.y),
- float(.25*index.x), float(.125*index.y),
+ float(.25*index2.x), float(.125*index2.y),
+ float(.25*index2.x), float(.125*index2.y),
+ float(.25*index2.x), float(.125*index2.y),
- float(.25*index.x), float(.125*index.y),
- float(.25*index.x), float(.125*index.y),
- float(.25*index.x), float(.125*index.y),
+ float(.25*index2.x), float(.125*index2.y),
+ float(.25*index2.x), float(.125*index2.y),
+ float(.25*index2.x), float(.125*index2.y),
};
glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, coord_front);
glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, front_tex);