aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.hpp27
-rw-r--r--include/entities.hpp2
-rw-r--r--include/texture.hpp1
3 files changed, 27 insertions, 3 deletions
diff --git a/include/common.hpp b/include/common.hpp
index e082a87..2442f5c 100644
--- a/include/common.hpp
+++ b/include/common.hpp
@@ -151,16 +151,25 @@ public:
float red;
float green;
float blue;
- Color()
+ float alpha;
+ Color()
{
- red = green = blue = 0;
+ red = green = blue = alpha = 0;
}
Color(float r, float g ,float b)
{
red = r;
green = g;
blue = b;
+ alpha = 255;
}
+ Color(float r, float g, float b, float a)
+ {
+ red = r;
+ green = g;
+ blue = b;
+ alpha = a;
+ }
Color operator-=(float a) {
red-=a;
green-=a;
@@ -175,6 +184,19 @@ public:
}
};
+/*
+ * A function used to tell the program what shader, attributes, and uniforms
+ * we want to draw our rectangles to. See below |
+ * \|/
+ */
+void useShader(GLuint *sh, GLint *tu, GLint *ca, GLint *ta);
+
+/*
+ * A function to draw a colored box for opengl
+ * To use it, the lower left hand and upper right hand coords are passed along
+ */
+void drawRect(vec2 ll, vec2 ur);
+
// gets the length of `n` HLINEs
template<typename T>
inline T HLINES(const T &n)
@@ -201,6 +223,7 @@ extern GLuint textShader;
extern GLint textShader_attribute_coord;
extern GLint textShader_attribute_tex;
extern GLint textShader_uniform_texture;
+extern GLint textShader_uniform_color;
extern GLuint worldShader;
extern GLint worldShader_attribute_coord;
diff --git a/include/entities.hpp b/include/entities.hpp
index 85b0ec1..ce2e14d 100644
--- a/include/entities.hpp
+++ b/include/entities.hpp
@@ -150,7 +150,7 @@ public:
~Particles(void){}
// draws the particle
- std::vector<std::pair<vec2, vec3>> draw(void) const;
+ void draw(std::vector<GLfloat> &verts, std::vector<GLfloat> &tex) const;
// updates a particle
void update(float _gravity, float ground_y);
diff --git a/include/texture.hpp b/include/texture.hpp
index ecf85e4..df2a83c 100644
--- a/include/texture.hpp
+++ b/include/texture.hpp
@@ -26,6 +26,7 @@ namespace Texture {
*/
GLuint loadTexture(std::string fileName);
+ GLuint genColor(Color c);
void freeTextures(void);