Skip to content

feat: implement keyboard and mouse input - #7

Merged
burdockcascade merged 3 commits into
masterfrom
feat_keyboard_mouse_input
Jul 26, 2026
Merged

feat: implement keyboard and mouse input#7
burdockcascade merged 3 commits into
masterfrom
feat_keyboard_mouse_input

Conversation

@burdockcascade

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 26, 2026 20:35
@burdockcascade burdockcascade linked an issue Jul 26, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds keyboard and mouse input support to VectorJS by exporting Raylib input enums into the JS module and exposing input-query helpers on the per-frame UpdateContext, with an example updated to demonstrate keyboard-driven control.

Changes:

  • Export Keyboard, MouseButton, and MouseCursor constants from the vectorjs module.
  • Implement keyboard/mouse query functions on the runtime UpdateContext object (isKeyPressed, getMousePosition, etc.).
  • Update the solar2d example to toggle/reset the simulation via keyboard input.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/vectorjs.d.ts Adds TS declarations for input enums and UpdateContext input methods.
src/api/js_utils.hpp Updates object-property helpers to support enums in exported objects.
src/api/hostapi.hpp Adds module exports for new input enum objects.
src/api/api_enums.cpp Exports Raylib keyboard/mouse enums into JS as objects.
src/api/api_context.cpp Builds an UpdateContext object with keyboard/mouse query functions.
examples/2d/solar2d.js Demonstrates new keyboard input API to control simulation state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api/js_utils.hpp
Comment on lines 183 to 185
template <typename T>
void set_object_property(JSContext* ctx, JSValueConst obj, const char* name, const T& val) {
void set_object_property(JSContext* ctx, JSValueConst obj, const char* name, const T& val) {
constexpr int flags = JS_PROP_ENUMERABLE | JS_PROP_CONFIGURABLE;
@burdockcascade
burdockcascade merged commit e00e2bb into master Jul 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add keyboard & mouse input

2 participants