summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2026-08-25 19:48:15 -0400
committerAndrew Opalach <andrew@akon.city> 2026-08-25 19:48:15 -0400
commitf48520c10ba822e13ef119f626b85fc081f96124 (patch)
tree8672a171b616b82feb74478d29f4205cf06488e9 /tests
parenta35c47d401335e81f25c2c78611dcb7785f703da (diff)
downloadstela-f48520c10ba822e13ef119f626b85fc081f96124.tar.gz
stela-f48520c10ba822e13ef119f626b85fc081f96124.tar.bz2
stela-f48520c10ba822e13ef119f626b85fc081f96124.zip
Raw input + drag and drop on Windows, cleanup
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'tests')
-rw-r--r--tests/window.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/window.c b/tests/window.c
index 7ce154c..8dc9c19 100644
--- a/tests/window.c
+++ b/tests/window.c
@@ -6,7 +6,11 @@
#include <al/math.h>
#include <nnwt/common.h>
#include <stl/window.h>
+#ifdef STELA_API_OPENGL
#include <stl/gl.h>
+#else
+typedef f32 GLfloat;
+#endif
#define DEFAULT_WIDTH 720
#define DEFAULT_HEIGHT 480
@@ -22,9 +26,10 @@ static const GLfloat init_rotation[] = { -25.f, 35.f, 0.f };
static GLfloat rotation[] = { init_rotation[0], init_rotation[1], init_rotation[2] };
static GLfloat zoom = 0.5f;
-static bool pointer_pos_callback(void *userdata, f64 x, f64 y)
+static bool pointer_callback(void *userdata, u8 type, f64 x, f64 y)
{
(void)userdata;
+ (void)type;
// There's probably a "standard" way to handle dragging here
// but this works well enough.
@@ -34,7 +39,7 @@ static bool pointer_pos_callback(void *userdata, f64 x, f64 y)
dx /= 2.f;
dy /= 2.f;
rotation[0] += dy;
- rotation[1] += rotation[0] > 140.f && rotation[0] < 290.f ? -dx : dx;
+ rotation[1] += (rotation[0] > 140.f && rotation[0] < 290.f) ? -dx : dx;
if (rotation[0] > 360.f) rotation[0] -= 360.f;
else if (rotation[0] < 0.f) rotation[0] += 360.f;
if (rotation[1] > 360.f) rotation[1] -= 360.f;
@@ -171,7 +176,7 @@ s32 window_system_main(u32 argc, str *argv, void *extra)
(void)extra;
window = stl_window_create();
- window->pointer_pos_callback = pointer_pos_callback;
+ window->pointer_callback = pointer_callback;
window->scroll_callback = scroll_callback;
window->mouse_button_callback = mouse_button_callback;
window->key_callback = key_callback;
@@ -204,6 +209,9 @@ s32 window_system_main(u32 argc, str *argv, void *extra)
if (argc > 1 && al_str_cmp(&argv[1], &al_str_c("w"), 0, 1) == 0) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
+#else
+ (void)argc;
+ (void)argv;
#endif
while (!quit) {