2015-01-01 03:04:34 +00:00
|
|
|
/*
|
|
|
|
** game.h - Game data structure
|
|
|
|
**
|
|
|
|
** 2014 - Frank Villaro-Dixon <Frank@Villaro-Dixon.eu>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GAME_H
|
|
|
|
#define GAME_H
|
|
|
|
|
|
|
|
#include "SDL/SDL.h"
|
|
|
|
|
|
|
|
#define SCREEN_WIDTH 640
|
|
|
|
#define SCREEN_HEIGHT 480
|
|
|
|
|
|
|
|
|
|
|
|
#define SHAPE_SQUARE 4
|
|
|
|
#define SHAPE_PENTAGON 5
|
|
|
|
#define SHAPE_HEXAGON 6
|
|
|
|
|
|
|
|
#define SHAPE_THICK 5
|
2015-01-01 03:34:12 +00:00
|
|
|
#define CURSOR_DIST 40
|
|
|
|
#define ANGLE_MAX 3600
|
2015-01-01 03:04:34 +00:00
|
|
|
|
2015-01-01 03:34:12 +00:00
|
|
|
#define OFFSET_POINT(p) {p.x += SCREEN_WIDTH/2; p.y += SCREEN_HEIGHT/2;}
|
|
|
|
#define TO_DEG(x) (x*ANGLE_MAX/360)
|
2015-01-01 03:04:34 +00:00
|
|
|
|
|
|
|
struct s_game {
|
|
|
|
#define CURSOR_POS_MAX 255
|
|
|
|
int cursor_angle; //relative to the polygon center's referential
|
|
|
|
int polygon_type; //Shape
|
2015-01-01 03:34:12 +00:00
|
|
|
int color;
|
2015-01-01 03:45:30 +00:00
|
|
|
int actual_speed;
|
2015-01-01 03:04:34 +00:00
|
|
|
|
|
|
|
SDL_Surface *screen;
|
2015-01-01 03:34:12 +00:00
|
|
|
Uint8 *keys;
|
2015-01-01 03:04:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct s_obstacle {
|
|
|
|
int thick;
|
|
|
|
int angle;
|
|
|
|
int distance;
|
2015-01-01 03:45:30 +00:00
|
|
|
int speed;
|
2015-01-01 03:04:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
init_game(struct s_game *g);
|
|
|
|
|
|
|
|
void
|
|
|
|
draw_game(struct s_game *g);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* ndef GAME_H */
|
|
|
|
|