-
Notifications
You must be signed in to change notification settings - Fork 0
/
genesis.h
152 lines (101 loc) · 3.6 KB
/
genesis.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "ncurses.h"
#include "blocks.h"
#define LOG(...) do{ \
FILE *file = fopen("log.txt", "a"); \
fprintf(file, __VA_ARGS__); \
fclose(file); \
} while(false)
#define NDEBUG(...) mvprintw( 0, 0, __VA_ARGS__ ); refresh()
#define DEBUG(...) fprintf(stdout, __VA_ARGS__)
#define PLAYER 1
#define WATER_DEEP 2
#define WATER_SHALLOW 3
#define SAND 4
#define GRASS 5
#define HILL 6
#define MOUNTAIN 7
struct Player
{
int xpos,ypos, xblock, yblock;
char token;
};
struct Block
{
int id;
int elevation;
char token;
int color;
//void* type;
};
struct Map
{
struct Block*** blocks;
};
struct Camera
{
int x,y,width,height,worldheight, worldwidth;
};
struct World
{
int width, height;
struct Map* map;
struct Camera* camera;
};
struct Game
{
bool running;
struct World* world;
struct Player* player;
};
/////////////////////////////////////////////////////////////////////////////////
//Game Manager //////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
int init_game(struct Game*);
int run(struct Game *);
////////////////////////////////////////////////////////////////////////////////
//Window Manager ///////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
int init_ui();
////////////////////////////////////////////////////////////////////////////////
//Input Manager/////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
int get_input(struct Game*);
int w_get_input(struct Game*, WINDOW*);
int move_player(struct Game*, short);
////////////////////////////////////////////////////////////////////////////////
//Graphics Manager//////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
int draw_shit(struct Game* game);
////////////////////////////////////////////////////////////////////////////////
//Utilities/////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
int init_colors();
int save_game(struct Game*);
int load_game(struct Game*);
int load_world(struct World*);
int build_block(struct Block*);
struct Game* malloc_game();
int malloc_player(struct Game*);
int malloc_world(struct Game*);
int malloc_map(struct Game*);
int malloc_camera(struct World*);
int screen_width(WINDOW *);
int screen_height(WINDOW *);
///////////////////////////////////////////////////////////////////////////////
//Player Manager///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int player_draw(struct Player*);
///////////////////////////////////////////////////////////////////////////////
//Camera Manager///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int camera_update(struct Camera*);
int camera_set_size(struct Camera*, int, int);
///////////////////////////////////////////////////////////////////////////////
//World Manager////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int world_draw(struct World*);
int world_update(struct World*);