1 // Brain Party
2 // Copyright (C) 2010 Paul Hudson (http://www.tuxradar.com/brainparty)
3 
4 // Brain Party is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 3
7 // of the License, or (at your option) any later version.
8 
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 
18 #ifndef __TEXTURE_H__
19 #define __TEXTURE_H__
20 
21 #include <string>
22 #include <cmath>
23 #include <iostream>
24 
25 #include <unistd.h>
26 #include "SDL.h"
27 #include "SDL_opengl.h"
28 
29 #include "Colour.h"
30 
31 using namespace std;
32 
33 class Texture {
34 public:
35 	GLuint Surface;
36 	float Width;
37 	float Height;
38 	float HalfWidth;
39 	float HalfHeight;
40 	float WidthRatio;
41 	float HeightRatio;
42 
43 	GLfloat TexCoords[8];
44 	GLfloat Vertices[12];
45 
46 	Texture(SDL_Surface* surface);
47 	Texture(const char* filename, float actualwidth, float actualheight);
48 	~Texture();
49 	void InitWithSurface(SDL_Surface* surface, float actualwidth, float actualheight);
50 	void Draw(float x, float y);
51 	void Draw(float x, float y, Colour &col);
52 	void Draw(float x, float y, float width, float height);
53 	void Draw(float x, float y, float rotation, float scale, Colour &col);
54 	static int NextPO2(int num);
55 };
56 
57 #endif
58