|
LI2 Roguelite
|
#include <stdio.h>#include <stdlib.h>#include <ncurses.h>#include "state.h"#include "player.h"#include "map.h"#include "cell.h"#include "item.h"#include "inventory.h"#include "monster.h"#include "combat.h"#include "menu.h"
Macros | |
| #define | NUMBER_OF_ITEMS 30 |
Functions | |
| State * | initState (int width, int height) |
| Initialize a new game state. More... | |
| void | freeState (void *p) |
| Free the game state. More... | |
| void | drawState (State *st) |
| Draw the game state. More... | |
| void | updateState (State *st, int input_key) |
| Update the game state. Used in the main loop. More... | |
| void | calculateState (State *st, int input_key) |
| Calulates the state based on the input key. More... | |
| #define NUMBER_OF_ITEMS 30 |
| void calculateState | ( | State * | st, |
| int | input_key | ||
| ) |
Calulates the state based on the input key.
| st | Calculated state |
| input_key | Input keyboard key |
| void drawState | ( | State * | st | ) |
Draw the game state.
Draws the map, the player, the monsters, the items and the projectiles
| st | The game state to draw |
| void freeState | ( | void * | p | ) |
Free the game state.
Free the map, the player and the monsters
| p | a pointer to the State to free |
| State* initState | ( | int | width, |
| int | height | ||
| ) |
Initialize a new game state.
Generates the map, the player and the monsters Returns NULL if the state could not be initialized
| void updateState | ( | State * | st, |
| int | input_key | ||
| ) |
Update the game state. Used in the main loop.
Calculates the new state based on the input key. Handles the exit and quit modes, then draws the new state.
| st | The game state to update |
| input_key | The input key from player |