Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
star.h
Go to the documentation of this file.
1 #ifndef _STAR_H_
2 #define _STAR_H_
3 #include "gfxlib.h"
4 
5 #include "gfxlib_struct.h"
6 const int STARnumvlist = 27;
7 #include <string>
8 
9 class StarVlist
10 {
11 protected:
12  float spread;
17  double lasttime;
18 public:
19  virtual void Draw( bool, int whichtex ) {}
20  StarVlist( float spread );
21  void UpdateGraphics();
22  virtual ~StarVlist() {}
23  virtual bool BeginDrawState( const QVector &center,
24  const Vector &vel,
25  const Vector &angular_vel,
26  bool rotate,
27  bool yawpitch,
28  int whichTexture )
29  {
30  return false;
31  }
32  virtual void EndDrawState( bool, int whichtex ) {}
33  virtual int NumTextures()
34  {
35  return 1;
36  }
37  void DrawAll( const QVector &center, const Vector &vel, const Vector &ang_vel, bool rot, bool yawpitch )
38  {
39  int LC = 0, LN = NumTextures();
40  for (LC = 0; LC < LN; ++LC) {
41  bool tmp = this->BeginDrawState( center, vel, ang_vel, rot, yawpitch, LC );
42  this->Draw( tmp, LC );
43  this->EndDrawState( tmp, LC );
44  }
45  }
46 };
47 
48 class PointStarVlist : public StarVlist
49 {
50  float smoothstreak;
51  GFXVertexList *vlist;
52  GFXVertexList *nonstretchvlist;
53 public: PointStarVlist( int num, float spread, const std::string &our_system_name );
55  bool BeginDrawState( const QVector &center,
56  const Vector &vel,
57  const Vector &angular_vel,
58  bool rotate,
59  bool yawpitch,
60  int whichTexture );
61  void Draw( bool, int whichTexture );
62  void EndDrawState( bool, int whichTexture );
63 };
64 
65 #define NUM_ACTIVE_ANIMATIONS 8
66 
67 class SpriteStarVlist : public StarVlist
68 {
70  class Texture*decal[NUM_ACTIVE_ANIMATIONS];
71 public: SpriteStarVlist( int num, float spread, std::string our_system_name, std::string texturename, float size );
73  int NumTextures();
74  bool BeginDrawState( const QVector &center,
75  const Vector &vel,
76  const Vector &angular_vel,
77  bool rotate,
78  bool yawpitch,
79  int whichTexture );
80  void Draw( bool, int whichTexture );
81  void EndDrawState( bool, int whichTexture );
82 };
83 
84 class Stars
85 {
86 private:
87  StarVlist *vlist;
88  QVector pos[STARnumvlist];
89  float spread;
90  bool blend;
91  bool fade;
92  void ResetPosition( const QVector &cent );
93  void UpdatePosition( const QVector &cp );
94 public: Stars( int num, float spread );
95  void SetBlend( bool blendit, bool fadeit );
96  void Draw();
97  ~Stars();
98 };
99 #endif
100