123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- /**
- * @file spaceship.h
- * @brief spawn, move, update and init struct_player
- */
- /**
- * @def SPACESHIP_H
- */
- #include <allegro5/allegro5.h>
- #include <stdbool.h>
- #ifndef SPACESHIP_H
- #define SPACESHIP_H
- #define SHIP_MAX 1
- #define SHIP_SCALE 1.0f
- #define SHIP_COLOR al_map_rgb(0,200,0)
- /**
- * @struct struct_player
- * structure to define general enemy with basic parameters.
- * @param sx - x coordinate on the plane
- * @param sy - y coordinate on the plane
- * @param heading - velocity vector of the ship(in radians)
- * @param twist - how the "sprite" is rotated
- * @param gone - is it dead
- * @param accel - is it accelerating
- * @param color - ALLEGRO_COLOR structure
- * */
- typedef struct struct_player {
- float sx;
- float sy;
- float heading;
- float twist;
- float speed;
- bool gone;
- bool accel;
- ALLEGRO_COLOR color;
- } Spaceship;
- /**
- * @fn void ship_update(Spaceship *s)
- * updates ship status.
- * @param s - pointer to the spaceship being updated.
- */
- void ship_update(Spaceship *s);
- /**
- * @fn void ship_check_pos(Spaceship *s)
- * checks for the spaceship position. If it's out of bounds, return it to the screen.
- * @param s - spaceship being updated. Should exist only one.
- */
- void ship_check_pos(Spaceship *s);
- /**
- * @fn void ship_speed(Spaceship *s, void (*change)(float*))
- * changes ship speed with one of the movement functions
- * @param s - pointer to the ship
- * @param change - pointer to the movement function
- */
- void ship_speed(Spaceship *s, void (*change)(float*));
- /**
- * @fn void ship_init(Spaceship *s)
- * initializes the spaceship. Does not allocates memory.
- * @param s - the only spaceship. Should not be NULL.
- */
- void ship_init(Spaceship *s);
- /**
- * @fn void ship_move(Spaceship *s, void (*direction)(float*, float*, float, float))
- * moves the ship with one of the movement functions.
- * @param s - pointer to the ship to move
- * @param direction - in what direction to move the ship. The basic movement functions.
- */
- void ship_move(Spaceship *s, void (*direction)(float*, float*, float, float));
- /**
- * @fn void ship_rotate(Spaceship *s, void (*direction)(float*))
- * rotate the ship with one of the movement function.
- * @param s - pointer to the ship to rotate
- * @param direction - rotate the ship CW and CCW. The basic movement functions.
- */
- void ship_rotate(Spaceship *s, void (*direction)(float*));
- #endif /* include SPACESHIP_H */
|