diff options
| author | KonAki <konaki@anokonaki.org> | 2026-10-09 17:38:43 +0800 |
|---|---|---|
| committer | KonAki <konaki@anokonaki.org> | 2026-10-09 17:38:43 +0800 |
| commit | 3e4acddeb4df4d21ad89b8926aa2eafc634daa25 (patch) | |
| tree | cf86972b240f2ea8752bd726cbed328dcd7de265 /examples | |
| parent | af7dafe1d79e39ba2d51a6e3f10990d9e8df3735 (diff) | |
Add mouse wheel events and wheel zoom in modelview
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/modelview.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/modelview.c b/examples/modelview.c index 29daa78..794457b 100644 --- a/examples/modelview.c +++ b/examples/modelview.c @@ -5,7 +5,7 @@ * run: obj/modelview [models/fox.kmdl] [pack file] * models: obj/konmodel art/models/Fox.glb assets/models/fox.kmdl -t models/ * - * mouse drag turns the camera, up and down zoom, space picks the next clip, + * mouse drag turns the camera, the wheel or up and down zoom, space picks the next clip, * left and right change the speed, f flat, l light, w wireframe, p pause * with the developer build the console (`) knows clips, clip, blend, and the variables flat light wire spin speed amount */ @@ -249,6 +249,9 @@ static void frame(void *data) if (program->pitch < -1.5f) program->pitch = -1.5f; program->dragX = ev.mouseX; program->dragY = ev.mouseY; + } else if (ev.type == KON_EVENT_MOUSE_WHEEL) { + while (ev.wheel > 0) { program->distance *= 0.9f; ev.wheel--; } + while (ev.wheel < 0) { program->distance /= 0.9f; ev.wheel++; } } else if (ev.type == KON_EVENT_KEY_DOWN) { if (ev.key == KON_KEY_SPACE && program->model->clipCount) { program->clip = (program->clip + 1) % program->model->clipCount; |
