aboutsummaryrefslogtreecommitdiff
path: root/include/smentity.hpp
blob: 54fb3fbf484ea0ff15c9f6efd0b495192010e8de (plain) (blame)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// -*- C++ -*-
/*
 * Simple MultimEdia LiTerator(SMELT)
 * by Chris Xiong 2015
 * Entity header
 *
 * WARNING: This library is in development and interfaces would be very
 * unstable.
 *
 */
#ifndef SMENTITY_H
#define SMENTITY_H
#include "smelt.hpp"
class smEntity2D
{
private:
	smEntity2D();
	static SMELT *sm;
	smQuad quad;
	float tx,ty,w,h,texw,texh;
	float ctrx,ctry;
public:
	smEntity2D(SMTEX tex,float _x,float _y,float _w,float _h);
	smEntity2D(SMTEX tex,smTexRect rect);
	smEntity2D(const smEntity2D &copy);
	~smEntity2D(){sm->smRelease();}
	void render(float x,float y,float rot=0,float wsc=1.,float hsc=0.);

	void setTexture(SMTEX tex);
	void setTextureRect4f(float _x,float _y,float _w,float _h);
	void setTextureRectv(smTexRect rect);
	void setColor(DWORD col,int v=-1);
	void setZ(float z,int v=-1);
	void setBlend(int blend);
	void setCentre(float x,float y);
	float _w(){return w;}
	float _h(){return h;}
};

class smEntity3D
{
private:
	smEntity3D();
	static SMELT *sm;
	smQuad quad;
	float tx,ty,w,h,texw,texh;
	float ctrx,ctry;
public:
	smEntity3D(SMTEX tex,float _x,float _y,float _w,float _h);
	smEntity3D(SMTEX tex,smTexRect rect);
	smEntity3D(const smEntity3D &copy);
	~smEntity3D(){sm->smRelease();}
	void render9f(float x,float y,float z,float ra=.0,float rx=.0,float ry=.0,float rz=.0,float wsc=1.,float hsc=0.);
	void renderfv(float* pos,float* rot,float* scale);

	void setTexture(SMTEX tex);
	void setTextureRect4f(float _x,float _y,float _w,float _h);
	void setTextureRectv(smTexRect rect);
	void setColor(DWORD col,int v=-1);
	void setBlend(int blend);
	void setCentre(float x,float y);
	float _w(){return w;}
	float _h(){return h;}
};
#endif