-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
87 lines (76 loc) · 2.14 KB
/
main.cpp
File metadata and controls
87 lines (76 loc) · 2.14 KB
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
/************************************************
Name: Juego_Loco
Copyright:
Author: Martín Cardozo
Date: 12/04/15 00:42
Description:
************************************************/
#include <allegro.h>
static const int WINDOW_WIDTH = 800;
static const int WINDOW_HEIGHT = 600;
static const bool FULLSCREEN = false; //
//MAIN LEVEL
#include "Level.h"
Level level0(WINDOW_WIDTH, WINDOW_HEIGHT);
//SOME CLASS INITIALIZATIONS
BITMAP* DrawObject::CANVAS;
Viewport* DrawObject::CAMERA;
int Character::upperLimit;
int Character::bottomLimit;
int Character::leftLimit;
int Character::rightLimit;
int Bullet::upperLimit;
int Bullet::bottomLimit;
int Bullet::leftLimit;
int Bullet::rightLimit;
//START ENGINE
void init();
void deinit();
//**********************************************/
//TODO: INCORPORAR INERCIA A PLAYER. [x]
//TODO: LIMITAR MOVIMIENTO A GRID. [x]
//TODO: EFECTO DISCO EN GRID. [x]
//TODO (el mas urgente): LEVANTAR ARCHIVO DE CONFIG (velocidades, tamaño de stage, disparo, etc). []
//TODO: HACERLO TIME-BASED. []
//TODO: HACER QUE LOS ZOMBIES SE MUEVAN BIEN (NO ANGULOS DE 45°). []
//TODO: HACER QUE LOS ZOMBIES CHOQUEN ENTRE SÍ. []
//TODO: EMPEZAR A CODIFICAR UNA MATRIZ DE OBSTACULOS EN GRID, Y CHECKEAR LOS BOUNDARIES PARA LIMITES, RAMPAS Y OBSTACULOS. []
//TODO: armar clase level y mandar todo ahi lo q noe s allegro
//*************************************************/
//MAIN FUNCTION
int main() {
//INIT ENGINE AND GAME
init();
level0.init();
//GAME LOOP
while (!key[KEY_ESC]) {
level0.update();
}
//TERMINATE GAME
deinit();
return 0;
};
END_OF_MAIN()
//***************** ALLEGRO STUFF ******************/
void init() {
int depth, res;
allegro_init();
depth = desktop_color_depth();
if (depth == 0) depth = 32;
set_color_depth(depth);
if(FULLSCREEN){
res = set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0);
}else{
res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0);
}
if (res != 0) {
allegro_message(allegro_error);
exit(-1);
}
install_timer();
install_keyboard();
install_mouse();
};
void deinit() {
clear_keybuf();
};