Mouse support - #73
Draft
AloXado320 wants to merge 1 commit into
Draft
Conversation
Prazon
added a commit
to Prazon/ACGC-PC-Together
that referenced
this pull request
Aug 6, 2026
Mouse input for the menu overlays, behind a new MOUSE_INPUT define. pc_mouse.c samples the mouse once per frame at the end of the SDL event pump, so every reader in a frame sees the same snapshot: button edges, wheel movement, motion, and a position mapped into GC screen space with the pillarbox correction undone. pc_mouse.h stays SDL-free so decomp translation units can include it, and folds to static inline no-ops when MOUSE_INPUT is off. Wired up in four interfaces, all keeping controller parity — whichever device was used last owns the cursor: - m_hand_ovl.c: hand renders from a separate visual_pos that eases toward the logical slot, so pointer movement stays smooth - m_tag_ovl.c: hover highlights table slots and submenu options, left click = A, right click = B, wheel scrolls the catalog - m_design_ovl.c: cursor drives the pattern grid, hovering switches between tool/grid/palette/canvas areas, strokes interpolate so fast drags leave no gaps - m_choice_main_normal.c_inc: dialogue choices highlight on hover Fixes applied on top of the draft PR: - pc_mouse.h defined its disabled-build fallbacks as non-inline functions in a header, one with a syntax error; now static inline - GET_BUTTON_PRESSED/GET_BUTTON_HELD were unparenthesised, so uses inside larger && expressions dropped the controller path's guard - the wheel accumulator was only cleared when a reader consumed it, so one scroll outside a menu left pc_mouse_active() true forever - motion was compared against the position from two frames back - mTG_mouse_move_func indexed tags[sel_tag_idx] before the bounds check mTG_move_func applies; sel_tag_idx is -1 with no tag up - the design overlay compared ->mode against a mDE_MAIN_MODE_* value from a different enum; now ->main_mode_act - palette and tool modes hand their whole move step to the mouse while it is active and only a button press released ownership, leaving the stick dead after touching the mouse; stick deflection now releases it too - added the missing pc_mouse.h includes, named the mouse button constants, widened fields holding fractional coords to f32, and tied the per-table mouse metadata array to mTG_TABLE_NUM with a size check Built with build_pc.bat (client and dedicated server link clean). Not yet exercised in game: the hit boxes are hand-tuned constants from the draft and several tables fall back to a default box.
Prazon
added a commit
to Prazon/ACGC-PC-Together
that referenced
this pull request
Aug 6, 2026
Mouse input for the menu overlays, behind a new MOUSE_INPUT define. pc_mouse.c samples the mouse once per frame at the end of the SDL event pump, so every reader in a frame sees the same snapshot: button edges, wheel movement, motion, and a position mapped into GC screen space with the pillarbox correction undone. pc_mouse.h stays SDL-free so decomp translation units can include it, and folds to static inline no-ops when MOUSE_INPUT is off. Wired up in four interfaces, all keeping controller parity — whichever device was used last owns the cursor: - m_hand_ovl.c: hand renders from a separate visual_pos that eases toward the logical slot, so pointer movement stays smooth - m_tag_ovl.c: hover highlights table slots and submenu options, left click = A, right click = B, wheel scrolls the catalog - m_design_ovl.c: cursor drives the pattern grid, hovering switches between tool/grid/palette/canvas areas, strokes interpolate so fast drags leave no gaps - m_choice_main_normal.c_inc: dialogue choices highlight on hover Fixes applied on top of the draft PR: - pc_mouse.h defined its disabled-build fallbacks as non-inline functions in a header, one with a syntax error; now static inline - GET_BUTTON_PRESSED/GET_BUTTON_HELD were unparenthesised, so uses inside larger && expressions dropped the controller path's guard - the wheel accumulator was only cleared when a reader consumed it, so one scroll outside a menu left pc_mouse_active() true forever - motion was compared against the position from two frames back - mTG_mouse_move_func indexed tags[sel_tag_idx] before the bounds check mTG_move_func applies; sel_tag_idx is -1 with no tag up - the design overlay compared ->mode against a mDE_MAIN_MODE_* value from a different enum; now ->main_mode_act - palette and tool modes hand their whole move step to the mouse while it is active and only a button press released ownership, leaving the stick dead after touching the mouse; stick deflection now releases it too - added the missing pc_mouse.h includes, named the mouse button constants, widened fields holding fractional coords to f32, and tied the per-table mouse metadata array to mTG_TABLE_NUM with a size check Built with build_pc.bat (client and dedicated server link clean). Not yet exercised in game: the hit boxes are hand-tuned constants from the draft and several tables fall back to a default box.
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.
Adds mouse support to most menu interfaces in the game, of which some makes sense logically.
Here's the changes in detail:
m_hand (Hand cursor)
m_tag (Menu table like interface for items and selection entries for it)
m_design (Design menu)
m_choice (Dialog choose selection)