Newer
Older
#ifndef GAME_H_INCLUDED
#define GAME_H_INCLUDED
#include <SDL/common.h>
#include <SDL/Button.h>
#include <SDL/InputBox.h>
#define RGB_WHITE 0x00FFFFFF
#define RGB_GREEN 0x0000FF00
#define RGB_GREY 0x00BEBEBE
#define RGB_RED 0x00FF0000
#define RGB_BLUE 0x000000FF
#define PERUDO_BACKGROUND_WIDTH 600
#define PERUDO_BACKGROUND_HEIGHT 480
#define PERUDO_TEXTBOX_WIDTH 800
#define PERUDO_TEXTBOX__HEIGHT 160
#define PERUDO_INFOBOX_WIDTH 200
#define PERUDO_INFOBOX__HEIGHT 480
#define PERUDO_NB_INPUTS 6
#define PERUDO_NB_BUTTONS 10
#define PERUDO_ACTIVE_BUTTONS 8
typedef struct stack{
unsigned int stack[BACKGROUND_STACK_SIZE];
unsigned short stackPointer;
}stack;
enum inputs{dice1,dice2,dice3,dice4,dice5,dice6,save,paco,dudo,clear};
typedef struct perudo{
SDL_Surface* background_screen;
SDL_Rect background_pos;
SDL_Surface* save_background;
Boolean left_click;
Boolean right_click;
Boolean is_active;
short tool;
stack stack;
SDL_InputBox input_box;
SDL_Surface* input_surf[PERUDO_NB_INPUTS];
SDL_Rect input_pos[PERUDO_NB_INPUTS];
TTF_Font* font;
SDL_Color text_color;
Uint32 draw_color;
Uint32 draw_color_bright;
Uint32 save_color;
Boolean input_active[PERUDO_ACTIVE_BUTTONS];
SDL_Button buttons[PERUDO_NB_BUTTONS];
SDL_Surface* button_state;
SDL_Rect button_state_pos;
SDL_Surface* background_error;
SDL_Rect background_error_pos;
SDL_Surface* textbox;
SDL_Rect textbox_pos;
SDL_Surface* infobox;
SDL_Rect infobox_pos;
SDL_Surface* textbox_image;
SDL_Surface* infobox_image;
Uint32 backgroundtext_color;
Uint32 backgroundinfo_color;
SDL_Surface* player[MAX_PLAYERS];
SDL_Surface* dices[MAX_DICES_PER_PLAYER];
Boolean nb_over,nb_over2;
Boolean value_over,value_over2;
void Perudo_launch(SDL_Surface* screen);
void Perudo_init(SDL_Surface* screen, perudo* background);
void Perudo_initBackground(perudo* background);
void Perudo_free(perudo* background);
void Perudo_createBackground(SDL_Surface* screen, perudo* background, SDL_Event* event);
Boolean Perudo_onSurface(short surfx, short surfy,short surfw, short surfh, short x, short y);
void SetPixel(SDL_Surface *surface, int x, int y, Uint32 pixel);
Uint32 GetPixel(SDL_Surface *surface, int x, int y);
void SetPixelSquare(SDL_Surface* surface, short sx0, short sy0, short x, short y, short widht, Uint32 pixel);
short Sqrt(short x, short y, short xf, short yf);
void Stack_emptyStack(stack* s,short h);
Boolean Stack_push(short x, short y, stack* s,short h);
Boolean Stack_pop(short* x, short* y, stack* s,short h);