Use floats for position in ship_init().
This commit is contained in:
@@ -138,7 +138,7 @@ int main() {
|
|||||||
if(!paused)
|
if(!paused)
|
||||||
{
|
{
|
||||||
if(key_is_down(KEY_RESET))
|
if(key_is_down(KEY_RESET))
|
||||||
ship_init(&ship, WINDOW_WIDTH / 2, WINDOW_HEIGHT / 2);
|
ship_init(&ship, (float)WINDOW_WIDTH / 2, (float)WINDOW_HEIGHT / 2);
|
||||||
else
|
else
|
||||||
ship_update(&ship);
|
ship_update(&ship);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#define SHIP_RADIUS 10.0f // radius of the ship in pixels
|
#define SHIP_RADIUS 10.0f // radius of the ship in pixels
|
||||||
|
|
||||||
void ship_init(struct ship *ship, int x, int y) {
|
void ship_init(struct ship *ship, float x, float y) {
|
||||||
assert(ship);
|
assert(ship);
|
||||||
ship->x = x;
|
ship->x = x;
|
||||||
ship->y = y;
|
ship->y = y;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ struct ship {
|
|||||||
* @param x Initial x position of the ship.
|
* @param x Initial x position of the ship.
|
||||||
* @param y Initial y position of the ship.
|
* @param y Initial y position of the ship.
|
||||||
*/
|
*/
|
||||||
void ship_init(struct ship *ship, int x, int y);
|
void ship_init(struct ship *ship, float x, float y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Updates the ship's variables according to keyboard
|
* @brief Updates the ship's variables according to keyboard
|
||||||
|
|||||||
Reference in New Issue
Block a user