Skip to main content

Module input

Module input 

Source
Expand description

§SDK Input API

Provides methods on GoudGame for querying input state: keyboard, mouse, and action mapping.

The input system is built on the InputManager ECS resource. The SDK wraps it so game code can query input without reaching into the ECS layer.

§Availability

This module requires the native feature (desktop platform with GLFW).

§Example

use goud_engine::sdk::GoudGame;
use glfw::Key;

let mut game = GoudGame::new(Default::default()).unwrap();

// In your game loop:
if game.is_key_pressed(Key::W) {
    // Move forward
}
if game.is_key_just_pressed(Key::Space) {
    // Jump (once per press)
}

let (mx, my) = game.mouse_position();
let scroll = game.scroll_delta();

Enums§

InputBinding
Represents a single input binding that can be mapped to an action.
Key
Input keys.
MouseButton
Mouse buttons. The MouseButtonLeft, MouseButtonRight, and MouseButtonMiddle aliases are supplied for convenience.