File: GLSprite.h

package info (click to toggle)
blockout2 2.4%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 5,492 kB
  • sloc: cpp: 8,694; ansic: 147; makefile: 106
file content (48 lines) | stat: -rw-r--r-- 992 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// -----------------------------------------------
// 2D sprites
// -----------------------------------------------
#include "SDL_opengl.h"

#ifndef _SPRITE2DH_
#define _SPRITE2DH_

class Sprite2D {

public:

  // Default constructor
  Sprite2D();
  
  // Initialise the font
  // return 1 when success, 0 otherwise
  int RestoreDeviceObjects(const char *diffName,const char *alphaName,int srcWidth,int scrHeight);

  // Update sprite mapping and coordinates
  void UpdateSprite(int x1,int y1,int x2,int y2);
  void UpdateSprite(int x1,int y1,int x2,int y2,float mx1,float my1,float mx2,float my2);
  void SetSpriteMapping(float mx1,float my1,float mx2,float my2);
  
  // Draw a 2D sprite (in screen coordinates)
  void Render();

  // Release any allocated resource
  void InvalidateDeviceObjects();

private:

  GLuint  texId;
  int x1;
  int y1;
  int x2;
  int y2;
  float mx1;
  float my1;
  float mx2;
  float my2;
  int hasAlpha;

  GLfloat pMatrix[16];

};

#endif /* _SPRITE2DH_ */