Skip to content

Feature/editbox widget - #5

Merged
rozensoftware merged 2 commits into
masterfrom
feature/editbox-widget
Jul 14, 2026
Merged

Feature/editbox widget#5
rozensoftware merged 2 commits into
masterfrom
feature/editbox-widget

Conversation

@rozensoftware

Copy link
Copy Markdown
Owner

No description provided.

New features:
- DrawEditBox(): renders text input field with optional cursor bar
- EditBoxProcessKey(): handles one raw scan code (insert/delete/arrows/Return/Esc)
- EditBoxPollKey(): convenience wrapper that reads and consumes current_key
- DrawGadget() now dispatches GADGET_TYPE_EDITBOX (type 2) via new EDITBOX struct
- editbox_sc_unshifted: 128-entry scan-code → ASCII table (unshifted US layout)

lib/gui.i:
- EDITBOX struct (28 bytes, offsets 0-19 match GADGET for transparent dispatch)
- GADGET_TYPE_EDITBOX = 2
- XREF/HAS extern declarations for new functions

lib/keyboardcodes.i:
- Completed all scan-code constants with verified Amiga HRM values
  (KEY_RETURN, KEY_BACKSP, KEY_TAB, all letters, all digits, punctuation,
   modifier keys, function keys)

examples/editbox_demo.has:
- Full interactive demo: type text, arrow cursor, backspace, Return (confirm),
  Escape (clear), mouse Exit button
Copilot AI review requested due to automatic review settings July 14, 2026 20:15
@rozensoftware
rozensoftware merged commit 11d9de2 into master Jul 14, 2026
1 check passed
@rozensoftware
rozensoftware deleted the feature/editbox-widget branch July 14, 2026 20:15

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

Key findings (need follow-up):

  • lib/gui.s now unconditionally references current_key, which introduces a hard link-time dependency on lib/keyboard.s for any consumer of lib/gui.s (even msgbox/button-only programs).
  • scripts/build_example.sh dependency closure needs to pull in lib/keyboard.s when lib/gui.s is selected; otherwise GUI examples that don’t extern keyboard symbols will fail to link.

Purpose:
Adds a new GUI EditBox widget to the Amiga-side GUI library (rendering + scan-code-driven text editing), plus helper build scripts and documentation so examples can be built more easily.

Changes:

  • Added EditBox rendering + input processing routines to lib/gui.s, plus new EDITBOX_* struct layout and gadget dispatch support in lib/gui.i.
  • Introduced scripts/build_example.sh to build .has examples with auto-selected library objects.
  • Expanded keyboard scan-code equates and added an end-to-end examples/editbox_demo.has, with docs + changelog updates.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
scripts/build.sh Generalized single-file build helper to accept .has or .s inputs and auto-detect toolchain paths.
scripts/build_example.sh New example build script that compiles HAS, assembles selected libs, and links into an Amiga executable.
lib/keyboardcodes.i Replaced placeholder key equates with HRM-based scan-code constants used by examples/libs.
lib/gui.s Added EditBox widget rendering, key processing, polling helper, and scan-code→ASCII table; updated gadget dispatch.
lib/gui.i Added GADGET_TYPE_EDITBOX, EDITBOX_* struct offsets, and XREFs for new EditBox routines.
examples/editbox_demo.has New demo showcasing EditBox typing/editing, submit/cancel behaviors, and mouse-driven exit.
docs/GUI_LIBRARY.md Documented EditBox APIs/struct layout and build integration updates.
docs/CHANGELOG.md Logged the new EditBox widget feature and related API additions.

Comment thread lib/gui.s
Comment on lines 60 to +63
XREF GetMouseDX
XREF GetMouseDY
XREF GetMouseLBtn
XREF current_key
Comment thread lib/gui.s
Comment on lines +1465 to +1469
editbox_sc_unshifted:
; $00-$07 ` 1 2 3 4 5 6 7
dc.b $60,$31,$32,$33,$34,$35,$36,$37
; $08-$0F 8 9 0 - = \(intl) [unused] 0(KP0)
dc.b $38,$39,$30,$2D,$3D,$5C,$00,$30
Comment thread scripts/build_example.sh
Comment on lines +159 to +163
gui.s)
for dep in "$LIB_DIR/graphics.s" "$LIB_DIR/input.s"; do
if [[ -z "${WANT_LIB[$dep]:-}" ]]; then add_dep "$dep"; changed=1; fi
done
;;
Comment thread scripts/build.sh
Comment on lines 87 to +91
echo "Assembling $OUT_S -> $OUT_O"
vasm68000_mot -Fhunkexe -o "$OUT_O" "$OUT_S"
"$VASM" -Fhunkexe -o "$OUT_O" "$OUT_S"

echo "Linking $OUT_O -> $OUT_EXE"
vlink -bamigahunk "$OUT_O" -o "$OUT_EXE"
"$VLINK" -bamigahunk "$OUT_O" -o "$OUT_EXE"
Comment thread docs/GUI_LIBRARY.md
Comment on lines 17 to 21
- [DrawButton](#drawbutton) ← 3D gadget style
- [DrawEditBox](#draweditbox)
- [EditBoxProcessKey](#editboxprocesskey)
- [EditBoxPollKey](#editboxpollkey)
- [DrawWrappedText](#drawwrappedtext)
Comment thread docs/GUI_LIBRARY.md
@@ -346,7 +456,10 @@ Pass `&cursor` (the address of the height word) to `CreateSprite`.
Link `lib/gui.s`, `lib/sprite.s` (if using cursor), `lib/input.s`, `lib/graphics.s`, `lib/font8x8.s`, `lib/helpers.s`, and `lib/takeover.s` together:
Comment thread examples/editbox_demo.has
Comment on lines +24 to +28
// python3 -m hasc.cli examples/editbox_demo.has -o build/editbox_demo.s
// vasmm68k_mot -Fhunkexe -I lib/ -o build/editbox_demo.o \
// build/editbox_demo.s lib/gui.s lib/graphics.s lib/font8x8.s \
// lib/helpers.s lib/input.s lib/keyboard.s lib/takeover.s
// vlink -bamigahunk build/editbox_demo.o -o build/editbox_demo.exe
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.

2 participants