/* MoleInvasion 0.1 - Copyright (C) 2004 - Guillaume Chambraud (linuxprocess@free.fr)

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version. */

#ifndef GRAPHICS_H
#define GRAPHICS_H

# include <stdio.h>
# include <stdlib.h>
# include <string.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>
#include "SDL.h"
#include "SDL_image.h"

/* from /usr/include/linux/kernel.h :-) */
#define MIN(x,y) ({ \
        typeof(x) _x = (x);	\
        typeof(y) _y = (y);	\
        (void) (&_x == &_y);	\
        _x < _y ? _x : _y; })

#define MAX(x,y) ({ \
        typeof(x) _x = (x);     \
        typeof(y) _y = (y);     \
        (void) (&_x == &_y);	\
        _x > _y ? _x : _y; })

void quit( int code );

/* chargement images */
SDL_Surface * IMG_LoadOptCkey(char *filename);
SDL_Surface * IMG_LoadOptAlpha(char *filename);
SDL_Surface * IMG_LoadOptNone(char *filename);

void imageGetPixel(SDL_Surface* image, 
	unsigned int x, unsigned int y, 
	unsigned char *r, unsigned char *v ,unsigned char *b); 

Uint32 coef_frame_rate(char show_FPS);

/* shared global vars */
#ifdef GRAPHICS_C
	SDL_Surface * g_SDL_screen;
#else
	extern SDL_Surface * g_SDL_screen;
#endif

#endif
