fix: replace keyboard lib with imgui in tiny video game example#5
Open
hugooole wants to merge 1 commit into
Open
fix: replace keyboard lib with imgui in tiny video game example#5hugooole wants to merge 1 commit into
hugooole wants to merge 1 commit into
Conversation
The `keyboard` library requires root on Linux to read /dev/input devices. Replace it with polyscope's bundled imgui (ImGuiKey_* + IsKeyDown) which works without elevated privileges inside the polyscope render loop.
There was a problem hiding this comment.
Code Review
This pull request replaces the keyboard library with imgui for handling key presses in the tiny_video_game example. It introduces a _KEY_MAP to translate string keys to imgui key constants and updates the IO.is_key_down method accordingly. I have no feedback to provide.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
keyboardlibrary dependency from example 4 (tiny video game)ImGuiKey_*constants +IsKeyDown())Root cause: The
keyboardlibrary on Linux reads/dev/inputdevices directly, which requires root privileges. This caused anImportError: You must be root to use this library on linux.at startup.Test plan
examples/4_tiny_video_game/main.pyas a normal (non-root) user and verify it starts without error