egui Keyboard Input: Arrow Keys, Clicks & Events | Rust GUI Ep 21

4views
00
11:40
T
Taught by Celeste AI - AI Coding Coach
View on YouTube
Description
Build a Key Explorer that responds to keyboard shortcuts and mouse clicks in egui! Learn ctx.input() with key_pressed() for arrow keys, Tab color cycling, Space reset, and Sense::click() for canvas marker placement. Student code: https://github.com/GoCelesteAI/egui_keyboard_mouse_input/tree/main What You'll Learn: - ctx.input(|i| { ... }) to read input state each frame - i.key_pressed(Key::ArrowUp) for single key press detection - Arrow keys and WASD for movement controls - Key::Tab for color cycling through a const array - Key::Space for reset functionality - ctx.request_repaint() to keep the UI updating for input - Sense::click() to make canvas regions respond to clicks - response.clicked() and interact_pointer_pos() for mouse handling - Painting markers with circle_filled and a movable cursor square - Neo-tree navigation with Enter, S (vsplit), and Ctrl+w Timestamps: 0:00 Intro 0:12 App Preview 0:22 What We're Building 0:54 Create Project & Cargo.toml 1:24 main.rs — App Entry Point 2:02 app.rs — COLORS Const Array 2:42 MyApp Struct & Default 3:48 impl App — request_repaint & ctx.input 4:22 Arrow Key & WASD Handlers 5:42 Tab Color Cycle & Space Reset 6:22 Clamping & Log Trimming 6:52 SidePanel — Labels, DragValue & Input Log 7:38 CentralPanel — Sense::click & Canvas 8:22 Drawing Markers & Cursor Square 8:54 cargo build & Neo-tree Browse 9:22 App Demo 10:19 Recap 10:59 Next Episode Series: Learn egui in Neovim Part of a 36-episode series teaching Rust GUI development with egui, coded entirely in Neovim with Neo-tree. Tags: egui, rust, gui, keyboard input, mouse click, tutorial, neovim, key explorer, ctx input, key_pressed, arrow keys, sense click

Tags

eguirustguikeyboard inputmouse clicktutorialneovimkey explorerctx inputkey_pressedarrow keyssense click
Back to tutorials

Duration

11:40

Published

March 14, 2026

Added to Codegiz

March 15, 2026

Open in YouTube