Add GUI widget library and enhance button functionality#2
Merged
Conversation
- Introduced `lib/gui.s` and `lib/gui.i` for a lightweight widget toolkit. - Added `DrawButton`, `GuiPollMouse`, `GuiHitTestRect`, `GuiHitTest`, `GetGuiMouseX`, and `GetGuiMouseY` functions. - Updated `CHANGELOG.md` with new features and changes in button rendering. - New documentation for the GUI library with usage instructions and API reference.
There was a problem hiding this comment.
Pull request overview
This PR updates the public-facing interface and documentation for the HAS GUI widget library by extending the lib/gui.i include header with additional external references / HAS templates, and by adding a full GUI library API reference plus corresponding changelog entries.
Changes:
- Extend
lib/gui.ito expose additional GUI mouse accessor entry points (GetGuiMouseX,GetGuiMouseY) and provide HASextern functemplates for the GUI API. - Add new end-user documentation (
docs/GUI_LIBRARY.md) describing the GUI drawing and input APIs, struct layout, and integration patterns. - Update
docs/CHANGELOG.mdto describe the new GUI library functionality and recent button-rendering behavior changes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/gui.i | Adds XREFs and HAS extern func comment templates for newly documented GUI entry points. |
| docs/GUI_LIBRARY.md | New GUI library documentation (API reference + usage/integration guidance). |
| docs/CHANGELOG.md | Documents new GUI features and behavior changes under Unreleased. |
Comment on lines
+31
to
+35
| ### Changed | ||
| - **`DrawButton` rendering** changed from a uniform `DrawBox` border to a **3D raised gadget** style (bright top/left highlight, black bottom/right shadow). Visual appearance now clearly distinguishes buttons from message-box windows. | ||
| - **`DrawButton` vertical centering** formula changed from `(y/8) + (h/8−1)/2` to `(y + h/2) / 8`, which rounds to the nearest character row rather than the topmost. For `h = 16`, text is now placed in the lower half of the button face instead of starting at the top border pixel. | ||
| - **`examples/msgbox_demo.has`** button dimensions updated from `(120, 240, 80, 16)` to `(100, 232, 120, 24)` to achieve perfect 7 px inner gap centering and give the button a standard Amiga gadget proportion. Window 4 height reduced from 48 to 40 px to accommodate the taller button within the 256-line screen. | ||
| - **`lib/gui.i`** updated with `XREF` declarations and HAS `extern func` comment templates for `DrawButton`, `GuiPollMouse`, `GuiHitTest`, `GuiHitTestRect`, `GetGuiMouseX`, and `GetGuiMouseY`. |
Comment on lines
+20
to
+24
| 4. [Mouse event manager](#mouse-event-manager) | ||
| - [GuiPollMouse](#guipollmouse) | ||
| - [GuiHitTestRect](#guihittestRect) | ||
| - [GuiHitTest](#guihittest) ← struct-based | ||
| - [GetGuiMouseX / GetGuiMouseY](#getguimousex--getguimousey) |
Comment on lines
+60
to
+67
| | Argument | Meaning | | ||
| |----------|---------| | ||
| | `x` | Left pixel | | ||
| | `y` | Top pixel | | ||
| | `w` | Width in pixels | | ||
| | `h` | Height in pixels | | ||
| | `color` | Palette index 0–31 | | ||
|
|
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.
lib/gui.sandlib/gui.ifor a lightweight widget toolkit.DrawButton,GuiPollMouse,GuiHitTestRect,GuiHitTest,GetGuiMouseX, andGetGuiMouseYfunctions.CHANGELOG.mdwith new features and changes in button rendering.