summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2010-05-17 15:31:25 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2010-05-17 15:31:25 +0200
commit3abc1401a11d07c6a8e632098a6682630f4a1ea9 (patch)
tree402191ae9e29f4d521d7f42ac7a6cb52b293c49e
parent8b5a03ca3f4cfe19fd8b21da5163e8dd37a2172f (diff)
Removed BulletAdder and friends.
-rw-r--r--main.cpp74
1 files changed, 1 insertions, 73 deletions
diff --git a/main.cpp b/main.cpp
index 5ee222c..7248393 100644
--- a/main.cpp
+++ b/main.cpp
@@ -20,31 +20,6 @@
#include "bullet.h"
#include "bulletpattern.h"
-class BulletAdder {
- public:
- unsigned int time;
- Bullet bullet;
-
- BulletAdder(unsigned int time, Bullet bullet) { this->time = time; this->bullet = bullet; }
-
- bool operator<(const BulletAdder& ba) {
- return time < ba.time;
- };
-};
-
-class BulletAdderComparison {
- bool reverse;
-
- public:
- BulletAdderComparison(const bool& revparam = false) { reverse = revparam; };
- bool operator()(const BulletAdder& left, const BulletAdder& right) {
- return (reverse ? left.time < right.time : left.time > right.time);
- };
-};
-
-std::list<Bullet> bullets;
-std::priority_queue<BulletAdder, std::vector<BulletAdder>, BulletAdderComparison> bullets_queue;
-
class BulletPattern1 : public BulletPattern {
unsigned int base;
public:
@@ -180,12 +155,6 @@ int main(int, char**) {
if(!paused) {
f += 0.0005 * step;
elapsed += step;
- while(bullets_queue.size() && bullets_queue.top().time <= elapsed) {
- BulletAdder ba = bullets_queue.top();
- Bullet& bullet = ba.bullet;
- bullets_queue.pop();
- bullets.push_back(bullet);
- }
for(std::vector<BulletPattern*>::iterator it = patterns.begin(); it < patterns.end(); it++) {
(*it)->update(elapsed, step);
}
@@ -230,54 +199,13 @@ int main(int, char**) {
(*it)->draw();
}
- glColor4f(0, 1, 0, 1);
-
- glBegin(GL_POINTS);
- for(it = bullets.begin(); it != bullets.end();) {
- Bullet& b = (*it);
-
- if(!paused) {
- b.pos.x += b.direction.x * step;
- b.pos.y += b.direction.y * step;
- b.pos.z += b.direction.z * step;
- }
-
- 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);
- glTexCoord2f(1, 0);
- glVertex3f(b.pos.x+1, b.pos.y-1, b.pos.z);
- glTexCoord2f(1, 1);
- glVertex3f(b.pos.x+1, b.pos.y+1, b.pos.z);
- glTexCoord2f(0, 1);
- glVertex3f(b.pos.x-1, b.pos.y+1, b.pos.z);*/
-
- if(b.pos.x < -b.radius || b.pos.x > 100+b.radius || b.pos.y < -b.radius || b.pos.y > 100+b.radius) {
- it = bullets.erase(it);
- } else {
- it++;
- }
- }
- glEnd();
- //glDisable(GL_POINT_SPRITE);
glDisable(GL_TEXTURE_2D);
-
glUseProgram(0);
glColor4f(1, 1, 1, 1);
char s[0xff];
- snprintf(s, 0xff, "Bullets: %d", (int)bullets.size());
- glRasterPos2f(1, 1);
- font.Render(s);
-
- snprintf(s, 0xff, "Queue: %d", (int)bullets_queue.size());
- glRasterPos2f(1, 1 + font.LineHeight() * (100.0 / 480.0));
- font.Render(s);
-
if(tick - lastframes >= 1000) {
fps = (float)frames * ((float)(tick - lastframes) / 1000.0f);
frames = 1;
@@ -286,7 +214,7 @@ int main(int, char**) {
frames++;
}
snprintf(s, 0xff, "FPS: %.2f", fps);
- glRasterPos2f(1, 1 + 2 * font.LineHeight() * (100.0 / 480.0));
+ glRasterPos2f(1, 1);
font.Render(s);