1 /* gamelib.h - sprite libs, etc 2 * 3 * copyright 06/26/2001 4 * dave blood - geekd@yahoo.com 5 * 6 * 7 */ 8 9 #ifndef _gamelib_h_ 10 #define _gamelib_h_ 11 12 13 14 #include "SDL.h" 15 16 #include "SDL_image.h" 17 18 #ifndef NOSOUND 19 #include "SDL_mixer.h" 20 #endif 21 22 23 typedef struct { 24 float x; 25 float y; 26 float x_vel; 27 float y_vel; 28 SDL_Surface *image; 29 int w; 30 int h; 31 } Sprite; 32 33 34 void CleanUp(void); 35 SDL_Surface *init_sdl(int width, int height, char *title, const char *win_icon); 36 void new_sprite(Sprite *s, const char *filename, int x, int y, int transparent, int alpha); 37 void new_sprite_surface(Sprite *temp, SDL_Surface *screen, int x, int y, int transparent); 38 39 #ifndef NOSOUND 40 Mix_Chunk *new_audio(char *filename); 41 void play_audio(Mix_Chunk *wave, int channel); 42 #endif 43 44 void draw_sprite(SDL_Surface *screen, Sprite obj); 45 short int collision_detect_perfect(Sprite obj1, Sprite obj2); 46 Uint32 getpixel(SDL_Surface *surface, int x, int y); 47 void press_any_key(SDLKey quit_key); 48 49 50 #endif 51