From 3abc1401a11d07c6a8e632098a6682630f4a1ea9 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Mon, 17 May 2010 15:31:25 +0200 Subject: Removed BulletAdder and friends. --- main.cpp | 74 +--------------------------------------------------------------- 1 file changed, 1 insertion(+), 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 bullets; -std::priority_queue, 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::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); -- cgit v1.2.3