Files
Tempus3214andClaude Opus 5.5 21c65ec065 Zoom the map with the scroll wheel
On the map the mouse moves the cursor, so it had no way to zoom: the zoom is the right stick's y, which only the
keys and a pad reached. While the map is open, each wheel notch is now a full-tilt push of that stick for 100 ms with
50 ms of neutral after it (a turn away from the player zooms in). A fast scroll's notches wait their turn, at most four,
and a turn the other way drops them. The wheel stays unbound elsewhere.

The back ends count the notches while the cursor is captured (input_win.c from raw input's usButtonData, input_sdl.c
from SDL_EVENT_MOUSE_WHEEL), keeping a high-resolution wheel's part of a notch (ikb_wheel_take).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 03:48:13 -03:00

23 lines
1.6 KiB
C

// Between input.c (gamepad, merging, scripts) and the keyboard and mouse of the window system's back end (input_win.c
// with Win32, input_sdl.c with SDL). Any thread.
#pragma once
#include <stdint.h>
// ---- what the back end provides
int ikb_foreground(void); // the game window is in front: keys count
int ikb_down(int key); // key id (input_map.h KEY_*) held, mouse buttons included
int ikb_escape(void); // Esc held (no key id: it belongs to the menu)
// The pointer in the client area, 0..1 from its top left; 0 when the window is not in front or the pointer is outside
int ikb_pointer(float *nx, float *ny);
void ikb_pointer_set(float nx, float ny); // moves the pointer there (the window in front only)
int ikb_captured(void); // the cursor is captured for the mouse camera
void ikb_mouse_take(int32_t *dx, int32_t *dy); // raw mouse motion since the last call, in counts
uint32_t ikb_mouse_travel(void); // raw counts the mouse moved in total (|dx| + |dy|), captured or not
int32_t ikb_wheel_take(void); // whole wheel notches turned while captured since the last call (+ away
// from the player); a high-resolution wheel's part of a notch is kept
void ikb_cursor_update(void); // what input_cursor_allowed says may have changed
void ikb_menu_closed(void); // the menu closed: a capture that Esc gave up comes back
// ---- what input.c provides the back end
int input_cursor_allowed(void); // no text entry or menu open, the mouse camera on, input not disabled