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
|
#include <SDL.h>
#include "glbase.h"
#include "glsprite.h"
#include "engine.h"
#define TEXSIZE 256
mogltk::glSprite::glSprite(Handle * h, int asx, int asy) : Sprite(h, asx, asy) {
}
mogltk::glSprite::glSprite(Uint8 * p, int asx, int asy) : Sprite(p, asx, asy) {
}
mogltk::glSprite::~glSprite() {
}
void mogltk::glSprite::draw(int dx, int dy, ColorP c) {
bool was2D;
was2D = mogltk::engine::glbase_o->is2D();
if (!was2D)
mogltk::engine::glbase_o->Enter2DMode();
c.Bind();
Bind();
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2i(GetPX() , GetPY() ); glVertex2i(dx , dy );
glTexCoord2i(GetPX() + GetSX() - 1, GetPY() ); glVertex2i(dx + GetSX() - 1, dy );
glTexCoord2i(GetPX() , GetPY() + GetSY() - 1); glVertex2i(dx , dy + GetSY() - 1);
glTexCoord2i(GetPX() + GetSX() - 1, GetPY() + GetSY() - 1); glVertex2i(dx + GetSX() - 1, dy + GetSY() - 1);
glEnd();
if (!was2D)
mogltk::engine::glbase_o->Leave2DMode();
}
|