aboutsummaryrefslogtreecommitdiff
path: root/src/entities/antifaShip.c
diff options
context:
space:
mode:
authornathansmithsmith <nathansmith7@mailfence.com>2023-08-06 16:50:59 -0600
committernathansmithsmith <nathansmith7@mailfence.com>2023-08-06 16:50:59 -0600
commit0e3f2f54c73ea3d473c38159dcb180eeb7988f4b (patch)
treeb6d903c0fa9bd93fe38e58c00c4419b2488f13f8 /src/entities/antifaShip.c
parent6411d4eabe48104211be728663afb146dbd12711 (diff)
About to fix the stupid mouse
Diffstat (limited to 'src/entities/antifaShip.c')
-rw-r--r--src/entities/antifaShip.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/entities/antifaShip.c b/src/entities/antifaShip.c
index c91f892..f9c9867 100644
--- a/src/entities/antifaShip.c
+++ b/src/entities/antifaShip.c
@@ -82,7 +82,7 @@ void controlAntifaShipKeyboardAndMouse(Game * game, Entity * entity) {
data->forwardSpeed += (speed * game->settings.scrollBarSpeed);
- if (data->forwardSpeed < 0.0)
+ if (data->forwardSpeed < 0.)
data->forwardSpeed = 0.0;
else if (data->forwardSpeed > ANTIFA_SHIP_MAX_SPEED)
data->forwardSpeed = ANTIFA_SHIP_MAX_SPEED;
@@ -91,11 +91,8 @@ void controlAntifaShipKeyboardAndMouse(Game * game, Entity * entity) {
data->lastMouse = mouse;
// Using mouse as a joystick.
- Vector3 mouseStick = (Vector3){
- v.y * game->settings.mouseSensitivity,
- -v.x * game->settings.mouseSensitivity,
- 0.0,
- };
+ Vector3 mouseStick = (Vector3){v.y, -v.x, 0.0};
+ mouseStick = Vector3Scale(mouseStick, game->settings.mouseSensitivity);
// Swap axis for more movement with mouse.
if (IsMouseButtonDown(MOUSE_BUTTON_MIDDLE)) {
@@ -103,7 +100,7 @@ void controlAntifaShipKeyboardAndMouse(Game * game, Entity * entity) {
mouseStick.y = 0.0;
}
- printVector2(mouse);
+ printVector2(v);
entityJoystickControl(entity, mouseStick, data->forwardSpeed);
}