summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 897c49b..be9a05e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -5,6 +5,7 @@
#include "time.h"
int main(int argc, char *argv[]) {
+ bool mouse_control = false;
srand(time(0));
InitWindow(800, 600, "hyperspace (demo)");
@@ -31,13 +32,27 @@ int main(int argc, char *argv[]) {
star->position = Generate3DPosition();
}
- StarUpdate(star);
+ float screen_center_x =
+ mouse_control ? GetMouseX() : GetScreenWidth() / 2.0;
+ float screen_center_y =
+ mouse_control ? GetMouseY() : GetScreenHeight() / 2.0;
+
+ StarUpdate(star, screen_center_x, screen_center_y);
DrawRectangle(star->renderPosition.x, star->renderPosition.y,
star->size.x, star->size.y, star->color);
}
EndDrawing();
+
+ // Listening for input
+ if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) {
+ mouse_control = !mouse_control;
+ if (mouse_control)
+ HideCursor();
+ else
+ ShowCursor();
+ }
}
return 0;