Huge code merge. This reflects the current status of my rewrite/restructuring. A...
[supertux.git] / src / type.h
1 //
2 // C Interface: type
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_TYPE_H
14 #define SUPERTUX_TYPE_H
15
16 #include <SDL/SDL.h>
17
18 /* 'Interoperability' type */
19
20 typedef struct itop_type
21   {
22     int* alive;
23     float* x;
24     float* y;
25     float* width;
26     float* height;
27     int* updated;
28   }
29 itop_type;
30
31 double get_frame_ratio(itop_type* pit);
32
33 /* Timer type */
34 typedef struct timer_type
35   {
36    unsigned int period;
37    unsigned int time;
38   }
39 timer_type;
40
41 void timer_init(timer_type* ptimer);
42 void timer_start(timer_type* ptimer, unsigned int period);
43 void timer_stop(timer_type* ptimer);
44 int timer_check(timer_type* ptimer);
45 int timer_started(timer_type* ptimer);
46 int timer_get_left(timer_type* ptimer);
47 int timer_get_gone(timer_type* ptimer);
48
49 /* Texture type */
50 typedef struct texture_type
51   {
52    SDL_Surface* sdl_surface;
53    unsigned gl_texture;
54    int w;
55    int h;
56   }  
57 texture_type;
58
59 void texture_load(texture_type* ptexture, char * file, int use_alpha);
60 void texture_from_sdl_surface(texture_type* ptexture, SDL_Surface * sdl_surf, int use_alpha);
61 void texture_free(texture_type* ptexture);
62 void texture_draw(texture_type* ptexture, float x, float y, int update);
63 void texture_draw_bg(texture_type* ptexture, int update);
64 void texture_draw_part(texture_type* ptexture, float x, float y, float w, float h, int update);
65
66 #endif /*SUPERTUX_TYPE_H*/
67