Fry3DX/engine/platform/input.h
Nexoniarz f3e8eca87b Fry3DX 0.4: an easy 3D modeller
Shapes with live settings, shape editing, knife and hole tools, drawing
shapes onto other objects, combining objects (add / subtract / overlap),
copies, thickness, painting with stickers and layers, a Layout tab, a
Print tab with checks, packed .fry files with autosave, export to GLB,
glTF, FBX, OBJ, 3MF, STL and PLY, folders in Layers, its own crash
screen, and a website for GitHub Pages in docs/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMSrd5oe1GpUD7E6d825KP
2026-10-19 21:18:35 +02:00

35 lines
1.2 KiB
C++

#pragma once
#include <string>
union SDL_Event;
namespace keel::input {
bool keyDown(int scancode); // SDL_SCANCODE_*
bool mouseDown(int button); // SDL_BUTTON_LEFT etc.
// Mouse movement since the last call, in pixels.
void takeMouseDelta(float& dx, float& dy);
// While captured the cursor is hidden and the game owns the mouse and keyboard.
bool captured();
// Key bindings, Quake/Source style: "bind w +forward" runs "+forward" on press
// and "-forward" on release; other commands run on press. Key names: letters,
// digits, "space", "ctrl", "shift", "escape", "f1".., "mouse1".."mouse5",
// "mwheelup", "mwheeldown".
void bind(const char* key, const char* command);
// Lines "unbindall" + "bind ..." for config.cfg.
std::string bindingsConfig();
// The key bound to `command` ("" if none), for menus.
std::string keyFor(const char* command);
// The next key pressed is reported here instead of running its binding (options menu).
void captureNextKey(void (*callback)(const char* keyName));
// Engine side.
void setCaptured(bool on);
// Never grab the mouse (test mode).
void disableCapture();
void handleEvent(const SDL_Event& ev);
// Releases every held "+" action (when a menu opens mid-press).
void releaseAll();
} // namespace keel::input