61 lines
1021 B
C
61 lines
1021 B
C
#ifndef MAIN_H
|
|
#define MAIN_H
|
|
|
|
#include "team.h"
|
|
#include <SDL/SDL.h>
|
|
|
|
#ifdef _WIN32
|
|
#include <windows.h>
|
|
#define MAIN APIENTRY WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
|
#else
|
|
#define MAIN main(int argc, char** argv)
|
|
#endif
|
|
|
|
#define MAX_DUDES 50
|
|
#define STACK_SIZE 5
|
|
#define DEFAULT_GAME_WIDTH 400
|
|
#define DEFAULT_GAME_HEIGHT 250
|
|
#define DEFAULT_WINDOW_WIDTH 800
|
|
#define DEFAULT_WINDOW_HEIGHT 500
|
|
#define DEFAULT_STARTING_ZOOM 2
|
|
#define NB_STARTING_FOOD 5
|
|
#define SPAWN_COOLDOWN 30
|
|
|
|
typedef struct{
|
|
int type;
|
|
void* data;
|
|
} t_pixel;
|
|
|
|
typedef struct{
|
|
t_coord pos;
|
|
int team;
|
|
int inventory;
|
|
int success;
|
|
int dead;
|
|
t_pixel ground;
|
|
t_action action;
|
|
void* custom_data;
|
|
t_com* com_data;
|
|
} t_dude;
|
|
|
|
typedef struct{
|
|
int team;
|
|
t_action (*update)();
|
|
int nb_dudes;
|
|
t_dude* dudes;
|
|
t_coord spawn;
|
|
int spawn_food;
|
|
int spawn_count;
|
|
} t_team;
|
|
|
|
void generateImg();
|
|
|
|
void handleAction(t_dude* dude);
|
|
|
|
// variables globales
|
|
t_pixel** map;
|
|
t_team* teams;
|
|
SDL_Surface* img;
|
|
|
|
#endif
|