12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- /**
- * @file blasteroids.h
- * @brief engine of the game. All logic and settings are here
- */
- /**
- * @def BLASTEROIDS_H
- */
- /* Project */
- #include <asteroid.h>
- #include <blast.h>
- #include <spaceship.h>
- #ifndef BLASTEROIDS_H
- #define BLASTEROIDS_H
- #define WIDTH 800
- #define HEIGHT 600
- #define FPS 60.0f
- #define KEYS_MAX 5
- #define ASTR_COLOR al_map_rgb(255,255,255)
- #define BG_COLOR al_map_rgb(0,0,30)
- enum enum_buttons {
- FW, BW, CW, CC, EX
- };
- /**
- * @fn void al_clear_keyboard_state(ALLEGRO_DISPLAY *display) - added so the funciton was defined.
- * for some reason function exists, but is not defined in allegro library.
- */
- void al_clear_keyboard_state(ALLEGRO_DISPLAY *display);
- /**
- * @fn void blasteroids_check_collision(Asteroid *a, Spaceship *s) - checks for collision between asteroid and spaceship.
- * @param a - asteroid to check collision with s
- * @param s - spaceship of the player
- */
- void blasteroids_check_collision(Asteroid *a, Spaceship *s);
- /**
- * @fn void blasteroids_init_control(void) - initializes all control using allegro library.
- */
- void blasteroids_init_control(void);
- /**
- * @fn void blasteroids_init_display(void) - initalizes the game window with allegro.
- * The size of the window is hardcoded into the WIDTH and HEIGHT constants.
- */
- void blasteroids_init_display(void);
- /**
- * @fn void blasteroids_init_timer(void) - initializes the allegro timer.
- */
- void blasteroids_init_timer(void);
- /**
- * @fn void blasteroids_init_events(void) - initializes the allegro events and registers all event sources(timer included).
- */
- void blasteroids_init_events(void);
- /**
- * @fn void blasteroids_loop(void) - main loop of the game, it runs until you close the display or press ESC.
- */
- void blasteroids_loop(void);
- /**
- * void blasteroids_exit(Spaceship *s, Asteroid **a, bool *keys,ALLEGRO_EVENT *event, ALLEGRO_TIMER *timer, ALLEGRO_EVENT_QUEUE *queue)
- * when blasteroids_loop ends it calls for blasteroids_exit to free allocated memory.
- * @param s - pointer to the spaceship
- * @param a - pointer to the array of Asteroid
- * @param keys - pointer to array of pressed keys
- * @param event - pointer to created ALLEGRO_EVENT event
- * @param timer - pointer to created ALLEGRO_TIMER timer
- * @param queue - pointer to created ALLEGRO_EVENT_QUEUE
- */
- void blasteroids_exit(Spaceship *s, Asteroid **a, bool *keys,
- ALLEGRO_EVENT *event, ALLEGRO_TIMER *timer, ALLEGRO_EVENT_QUEUE *queue);
- #endif
|