lots of improvements all over the code.
[supertux.git] / src / texture.h
1 //
2 // C Interface: texture
3 //
4 // Description: 
5 //
6 //
7 // Author: Tobias Glaesser <tobi.web@gmx.de>, (C) 2004
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12
13 #ifndef SUPERTUX_TEXTURE_H
14 #define SUPERTUX_TEXTURE_H
15
16 #include <SDL.h>
17 #include <string>
18 #ifndef NOOPENGL
19 #include <SDL_opengl.h>
20 #endif
21
22 #include "screen.h"
23
24 /* Texture type */
25 struct texture_type
26 {
27   SDL_Surface* sdl_surface;
28   unsigned gl_texture;
29   int w;
30   int h;
31 };
32
33 void texture_setup(void);
34 extern void (*texture_load) (texture_type* ptexture, const std::string& file, int use_alpha);  
35 extern void (*texture_load_part) (texture_type* ptexture, const std::string& file, int x, int y, int w, int h, int use_alpha);
36 extern void (*texture_free) (texture_type* ptexture);  
37 extern void (*texture_draw) (texture_type* ptexture, float x, float y, Uint8 alpha = 255, bool update = false);
38 extern void (*texture_draw_bg) (texture_type* ptexture,  Uint8 alpha = 255, bool update = false);
39 extern void (*texture_draw_part) (texture_type* ptexture, float sx, float sy, float x, float y, float w, float h,  Uint8 alpha = 255, bool update = false);
40 void texture_load_sdl(texture_type* ptexture, const std::string&, int use_alpha);
41 void texture_load_part_sdl(texture_type* ptexture, const std::string& file, int x, int y, int w, int h, int use_alpha);
42 void texture_free_sdl(texture_type* ptexture);
43 void texture_draw_sdl(texture_type* ptexture, float x, float y, Uint8 alpha, bool update);
44 void texture_draw_bg_sdl(texture_type* ptexture,  Uint8 alpha, bool update);
45 void texture_draw_part_sdl(texture_type* ptexture,float sx, float sy, float x, float y, float w, float h,  Uint8 alpha, bool update);
46 void texture_from_sdl_surface(texture_type* ptexture, SDL_Surface * sdl_surf, int use_alpha);
47 #ifndef NOOPENGL
48 void texture_load_gl(texture_type* ptexture, const std::string& file, int use_alpha);
49 void texture_load_part_gl(texture_type* ptexture, const std::string& file, int x, int y, int w, int h, int use_alpha);
50 void texture_free_gl(texture_type* ptexture);
51 void texture_draw_gl(texture_type* ptexture, float x, float y,  Uint8 alpha, bool update);
52 void texture_draw_bg_gl(texture_type* ptexture,  Uint8 alpha, bool update);
53 void texture_draw_part_gl(texture_type* ptexture, float sx, float sy, float x, float y, float w, float h,  Uint8 alpha, bool update);
54 void texture_create_gl(SDL_Surface * surf, GLuint * tex);
55 #endif
56
57 #endif /*SUPERTUX_TEXTURE_H*/
58