Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Sprite.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: Sprite.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Sprite Object
13 */
14 
15 #ifndef Sprite_h
16 #define Sprite_h
17 
18 #include "Types.h"
19 #include "Graphic.h"
20 #include "Polygon.h"
21 
22 // +--------------------------------------------------------------------+
23 
24 class Bitmap;
25 
26 class Sprite : public Graphic
27 {
28 public:
29  static const char* TYPENAME() { return "Sprite"; }
30 
31  Sprite();
32  Sprite(Bitmap* animation, int length=1, int repeat=1, int share=1);
33  virtual ~Sprite();
34 
35  // operations
36  virtual void Render(Video* video, DWORD flags);
37  virtual void Render2D(Video* video);
38  virtual void Update();
39  virtual void Scale(double scale);
40  virtual void Rescale(double scale);
41  virtual void Reshape(int w1, int h1);
42 
43  // accessors / mutators
44  int Width() const { return w; }
45  int Height() const { return h; }
46  int Looping() const { return loop; }
47  int NumFrames() const { return nframes; }
48  double FrameRate() const;
49  void SetFrameRate(double rate);
50 
51  double Shade() const { return shade; }
52  void SetShade(double s) { shade = s; }
53  double Angle() const { return angle; }
54  void SetAngle(double a) { angle = a; }
55  int BlendMode() const { return blend_mode; }
56  void SetBlendMode(int a) { blend_mode = a; }
57  int Filter() const { return filter; }
58  void SetFilter(int f) { filter = f; }
59  virtual void SetAnimation(Bitmap* animation, int length=1, int repeat=1, int share=1);
60  virtual void SetTexCoords(const double* uv_interleaved);
61 
62  Bitmap* Frame() const;
63  void SetFrameIndex(int n);
64 
65  virtual bool IsSprite() const { return true; }
66 
67 protected:
68  int w, h;
69  int loop;
70 
71  int nframes;
75  DWORD frame_time;
76  DWORD last_time;
77  double shade;
78  double angle;
80  int filter;
81 
85 };
86 
87 // +--------------------------------------------------------------------+
88 
89 #endif Sprite_h
90