Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Juego.h
- // Base para juego de plataformas en C++ y Allegro
- #ifndef JUEGO_H_INCLUDED
- #define JUEGO_H_INCLUDED
- // Allegro
- #include <allegro5/allegro.h>
- // Macros de color
- #define C_NEGRO al_map_rgb(0, 0, 0)
- #define C_BLANCO al_map_rgb(255, 255, 255)
- // Macro para checar colisiones "bounding box"
- #define bbox_collision(x1,y1,w1,h1,x2,y2,w2,h2) \
- (!(((x1)>=(x2)+(w2)) || ((x2)>=(x1)+(w1)) || \
- ((y1)>=(y2)+(h2)) || ((y2)>=(y1)+(h1))))
- // Tamaño del jugador, usado para checar una posición libre y dibujarlo
- #define TAMANO_JUGADOR_X 32
- #define TAMANO_JUGADOR_Y 32
- // Tamaño en columnas por defecto de los niveles
- #define TAMANO_NIVEL_X 25
- class Juego
- { // Indicar si el juego inició correctamente
- bool iniciado;
- // Variables del jugador/player
- float jugador_x, jugador_y;
- float jugador_x_inicio, jugador_y_inicio;
- // Ventana (display)
- ALLEGRO_DISPLAY *ventana;
- // Timer que controla los FPS
- ALLEGRO_TIMER *timer;
- // Lista donde surgen los eventos de Allegro
- ALLEGRO_EVENT_QUEUE *lista_eventos;
- // Array para almacenar las pulsaciones del teclado
- int *key;
- bool Inicializar();
- void Actualizar();
- void Dibujar();
- public:
- Juego();
- void Correr();
- };
- #endif // JUEGO_H_INCLUDED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement