Example Tank


Modules

 Bullet Elf
 Tank Elf
 Tank elf module provides control functions of tanks in game.
#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

Enumerations

enum  { MUD, ROC, BRI, BSH }
 Tile types in a map. More...

Variables

static char map [12][16]
 Map of the game.

Define Documentation

#define CHANGE_POS ( g,
x,
 ) 

Value:

do {                    \
        (g)->root_coord->matrix[0] = 1.0;               \
        (g)->root_coord->matrix[2] = x;                 \
        (g)->root_coord->matrix[4] = 1.0;               \
        (g)->root_coord->matrix[5] = y;                 \
        rdman_coord_changed(rdman, (g)->root_coord);    \
    } while(0)

Definition at line 566 of file tank_main.c.

#define MAP_H   12

Definition at line 43 of file tank_main.c.

#define MAP_W   16

Definition at line 42 of file tank_main.c.


Enumeration Type Documentation

anonymous enum

Tile types in a map.

Enumerator:
MUD 
ROC 
BRI 
BSH 

Definition at line 12 of file tank_main.c.


Function Documentation

static void init_keyboard ( tank_rt_t tank_rt  )  [static]

Definition at line 613 of file tank_main.c.

void initial_tank ( tank_rt_t tank_rt,
X_MB_runtime_t mb_rt 
)

Definition at line 655 of file tank_main.c.

static void keyboard_handler ( event_t event,
void *  arg 
) [static]

Definition at line 574 of file tank_main.c.

int main ( int  argc,
char *const   argv[] 
)

Definition at line 727 of file tank_main.c.

static void make_elf_coords ( redraw_man_t rdman,
coord_t **  coord_pos,
coord_t **  coord_rot,
coord_t **  coord_center 
) [static]

Make coord objects to decorate elfs (tanks).

These coords are used to shift (move) and rotate decorated graphic. The coords can easy work of programmer to manipulate geometry of decorated graphic.

Definition at line 635 of file tank_main.c.


Variable Documentation

char map[12][16] [static]

Initial value:

 {
    { MUD, MUD, MUD, MUD, MUD, MUD, MUD, MUD,
      MUD, MUD, MUD, MUD, MUD, MUD, MUD, MUD},
    { MUD, ROC, ROC, ROC, MUD, BSH, BSH, ROC,
      BSH, ROC, MUD, BSH, BSH, ROC, ROC, MUD},
    { MUD, MUD, BRI, MUD, MUD, MUD, MUD, MUD,
      MUD, MUD, MUD, BRI, MUD, MUD, BSH, MUD},
    { BRI, MUD, MUD, MUD, MUD, MUD, BRI, MUD,
      BRI, MUD, MUD, MUD, MUD, MUD, MUD, MUD},
    { MUD, MUD, BRI, MUD, BRI, BSH, BRI, BRI,
      BRI, BRI, BSH, ROC, ROC, MUD, BRI, MUD},
    { MUD, BRI, BRI, MUD, BRI, MUD, BRI, MUD,
      ROC, MUD, MUD, MUD, MUD, MUD, MUD, MUD},
    { MUD, MUD, MUD, MUD, MUD, MUD, MUD, MUD,
      MUD, MUD, MUD, BRI, BRI, BRI, BRI, MUD},
    { MUD, BRI, MUD, BRI, BRI, MUD, BRI, BRI,
      BSH, BRI, MUD, MUD, MUD, MUD, MUD, MUD},
    { MUD, BRI, MUD, MUD, MUD, MUD, MUD, MUD,
      MUD, MUD, MUD, BRI, BRI, MUD, BRI, BRI},
    { MUD, BRI, MUD, BRI, BRI, MUD, BRI, BRI,
      BRI, BRI, MUD, BRI, MUD, MUD, MUD, MUD},
    { MUD, BSH, MUD, BRI, MUD, MUD, BRI, MUD,
      MUD, BRI, MUD, MUD, MUD, BRI, BRI, MUD},
    { MUD, MUD, MUD, MUD, MUD, MUD, BRI, MUD,
      MUD, BRI, MUD, BRI, MUD, MUD, MUD, MUD}
}
Map of the game.

Definition at line 15 of file tank_main.c.

SourceForge.net Logo