diff options
author | nathansmithsmith <nathansmith7@mailfence.com> | 2023-09-21 21:28:50 -0600 |
---|---|---|
committer | nathansmithsmith <nathansmith7@mailfence.com> | 2023-09-21 21:28:50 -0600 |
commit | ff2c529dda20dba1ea7ef21f46703d59fb49178b (patch) | |
tree | 306f7b2749b4a7349f7dd2a505cd8b41c75942f9 /src/entities/antifaShip.c | |
parent | 0387c05d7d4b784b91ea35b88caa12c4fc9fd6d3 (diff) |
Better looking gyro
Diffstat (limited to 'src/entities/antifaShip.c')
-rw-r--r-- | src/entities/antifaShip.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/entities/antifaShip.c b/src/entities/antifaShip.c index fb307fb..bd64545 100644 --- a/src/entities/antifaShip.c +++ b/src/entities/antifaShip.c @@ -29,6 +29,7 @@ void initAntifaShip(Entity * entity, Game * game) { AntifaShip * data = (AntifaShip*)entity->data; data->lastMouse = GetMousePosition(); data->forwardSpeed = 0.0; + data->shouldInitMousePosition = true; } void closeAntifaShip(Entity * entity) { @@ -77,6 +78,12 @@ void controlAntifaShipJoystick(Game * game, Entity * entity) { void controlAntifaShipKeyboardAndMouse(Game * game, Entity * entity) { AntifaShip * data = (AntifaShip*)entity->data; + // Resets mouse on init. + if (data->shouldInitMousePosition) { + data->shouldInitMousePosition = false; + SetMousePosition(0, 0); + } + // Get mouse values. Vector2 mouse = GetMousePosition(); float speed = GetMouseWheelMove(); |