#include <math.h>
#include <sys/time.h>
#include <string.h>
#include <mb.h>
#include <mb_tools.h>
#include "svgs.h"
Go to the source code of this file.
Classes | |
struct | _tank_bullet |
Information about bullet elf. More... | |
struct | _tank |
Information about a tank elf. More... | |
struct | _tank_rt |
Runtime information for tank, this game/example. More... | |
#define | PI 3.1415926 |
static tank_t * | tank_new (coord_t *coord_pos, coord_t *coord_rot, int map_x, int map_y, tank_rt_t *tank_rt) |
static void | tank_free (tank_t *tank, X_MB_runtime_t *xmb_rt) |
static void | clean_tank_progm_handler (event_t *event, void *arg) |
Clean program for a tank. | |
static void | tank_move (tank_t *tank, int direction, tank_rt_t *tank_rt) |
#define | CHANGE_POS(g, x, y) |
static void | keyboard_handler (event_t *event, void *arg) |
static void | init_keyboard (tank_rt_t *tank_rt) |
static void | make_elf_coords (redraw_man_t *rdman, coord_t **coord_pos, coord_t **coord_rot, coord_t **coord_center) |
Make coord objects to decorate elfs (tanks). | |
void | initial_tank (tank_rt_t *tank_rt, X_MB_runtime_t *mb_rt) |
int | main (int argc, char *const argv[]) |
Defines | |
#define | MAP_W 16 |
#define | MAP_H 12 |
Typedefs | |
typedef struct _tank_bullet | tank_bullet_t |
typedef struct _tank | tank_t |
typedef struct _tank_rt | tank_rt_t |
Enumerations | |
enum | { MUD, ROC, BRI, BSH } |
Tile types in a map. More... | |
enum | { BU_UP = 0, BU_RIGHT, BU_DOWN, BU_LEFT } |
The direction a bullet is going. More... | |
enum | { TD_UP = 0, TD_RIGHT, TD_DOWN, TD_LEFT } |
Functions | |
static void | make_bullet_elf_coords (redraw_man_t *rdman, coord_t **coord_pos, coord_t **coord_rot, coord_t **coord_center) |
Make coord objects for bullet elfs. | |
static tank_bullet_t * | tank_bullet_new (redraw_man_t *rdman, int map_x, int map_y, int direction) |
static void | tank_bullet_free (tank_bullet_t *bullet) |
static void | bullet_go_out_map (event_t *event, void *arg) |
static void | bullet_bang (tank_bullet_t *bullet, int map_x, int map_y) |
static void | bullet_hit_chk (const mb_timeval_t *tmo, const mb_timeval_t *now, void *arg) |
To check if a bullet hits walls or tanks. | |
static void | tank_fire_bullet (tank_rt_t *tank_rt, tank_t *tank) |
To fire a bullet for a tank. | |
Variables | |
static char | map [12][16] |
Map of the game. |
#define PI 3.1415926 |
Definition at line 169 of file tank_main.c.
Definition at line 94 of file tank_main.c.
static void clean_tank_progm_handler | ( | event_t * | event, | |
void * | arg | |||
) | [static] |
Clean program for a tank.
It is called when the program is completed.
Definition at line 162 of file tank_main.c.
static void tank_free | ( | tank_t * | tank, | |
X_MB_runtime_t * | xmb_rt | |||
) | [static] |
Definition at line 148 of file tank_main.c.
Definition at line 171 of file tank_main.c.