#ifndef BULLETPATTERN_H #define BULLETPATTERN_H #include "vector.h" #include "struct.h" #include class BulletPattern { public: float color_r, color_g, color_b; virtual void update() = 0; virtual void draw() = 0; }; template class BulletPatternImpl : public BulletPattern { protected: struct Bullet { Vector2 pos; Vector2 dir; Data data; }; Bullet* bullets; unsigned int num_bullets; unsigned int steps; public: void draw() { glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(4, GL_FLOAT, sizeof(*bullets), bullets); glDrawArrays(GL_POINTS, 0, num_bullets); glDisableClientState(GL_VERTEX_ARRAY); } }; class BulletPattern1 : public BulletPatternImpl { public: BulletPattern1(const Vector2& initpos); void update(); }; class BulletPattern2 : public BulletPatternImpl > { public: BulletPattern2(const Vector2& initpos); void update(); }; class BulletPattern3 : public BulletPatternImpl > { public: BulletPattern3(const Vector2& initpos); void update(); }; #endif