diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -18,6 +18,7 @@ #include "shader.h" #include "vector.h" #include "bullet.h" +#include "bulletpattern.h" class BulletAdder { public: @@ -57,14 +58,7 @@ void create_pattern1(unsigned int base) { } void create_pattern2(unsigned int base) { - for(float i = 0; i < M_PI * 16; i += 0.1) { - bullets_queue.push(BulletAdder(base + (unsigned int)(i*40), - Bullet( - Vector3(50.0 + cosf(i) * 5, - 50.0 + sinf(i) * 5, 0), - Vector3(cosf(i) / 100.0, sinf(i) / 100.0, 0), - 5))); - } + } void create_pattern2_2(unsigned int base) { @@ -131,6 +125,8 @@ int main(int, char**) { glShadeModel(GL_SMOOTH); create_bullets(); + + BulletPattern* pattern = new BulletPattern(); TextureSDL texture1("foo.png"); TextureSDL texture2("foo4.png"); @@ -195,7 +191,9 @@ int main(int, char**) { bullets_queue.pop(); bullets.push_back(bullet); } + pattern->update(elapsed, step); } + gluLookAt( 5 * sinf(f), 1, 5 * cosf(f), 0, 0, 0, @@ -228,6 +226,13 @@ int main(int, char**) { glPointSize(16.0); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture2.tex()); + + glColor4f(1, 0, 0, 1); + + pattern->draw(); + + glColor4f(0, 1, 0, 1); + glBegin(GL_POINTS); for(it = bullets.begin(); it != bullets.end();) { Bullet& b = (*it); @@ -238,9 +243,8 @@ int main(int, char**) { b.pos.z += b.direction.z * step; } - glColor4f(0, 1, 0, 1); - glVertex4f(b.pos.x, b.pos.y, b.direction.x, b.direction.y); + //glColor3f(b.color.r, b.color.g, b.color.b); /*glTexCoord2f(0, 0); glVertex3f(b.pos.x-1, b.pos.y-1, b.pos.z); |