Splits the flat 432-line main.rs into four modules so each file has one
clear job: render.rs owns layout constants and drawing primitives,
editor.rs owns EditorTab/EditorState and the side panel, glyph_picker.rs
owns the floating picker dialog with a decoupled (open, glyph) interface,
and main.rs is reduced to AppMode, App, and the frame loop (~150 lines).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract draw_board() to eliminate duplicated board+player render loop in Edit and Play branches
- Extract pos_to_cell() to eliminate duplicated click-to-cell floor math in board and char grid handlers
- Simplify glyph dedup to use Glyph: PartialEq directly instead of manual key tuples
- Merge two identical clicked() handlers in archetype list into one || check
- Remove WHAT-explaining comments
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Selecting a different archetype in the editor now updates the active
glyph to that archetype's default_glyph(), keeping the visual preview
in sync with the selected behavior type.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Glyph chooser: a painted preview button in the Palette tab opens a
floating dialog with a board-palette picker, fg/bg color pickers
(egui built-in), and a 16×6 printable ASCII character grid. The
stamped glyph is now independent of the archetype's default.
Side panel: widened to 200 px (resizable), tabbed (Palette / Board /
World), archetype rows show their default glyph cell, list scrolls
after 5 entries, labels use ui.label() for consistent sizing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Edit mode now wraps the board in a ScrollArea so horizontal/vertical
scroll bars appear when the board is larger than the window. Play mode
keeps the existing player-centered viewport with no scroll bars.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Window size is now fixed (840×524) and independent of map dimensions.
Small maps center in the viewport; maps larger than the viewport keep
the player centered and clamp at board edges so no empty space shows.
Also derives Copy+Clone on Player to enable the per-frame origin calculation.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents the replacement of Element with Behavior + Archetype, the
elimination of the per-board element palette, the new map file format
(archetype = "name" instead of passable = bool), the ErrorBlock sentinel,
and the editor mode (AppMode, EditorState, palette panel, click-to-paint).
Also updates "What's not yet implemented" to reflect editor progress and
call out the Object behavior / glyph chooser / file open gaps.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AppMode enum (Play/Edit) gates arrow-key input; a mode toggle in the
menu bar switches between them. Edit mode shows a SidePanel listing the
available archetypes (Empty, Wall, Object); clicking one selects it.
Clicking a board cell in Edit mode stamps it with the selected
archetype's default glyph. Mouse-to-cell conversion mirrors the
rendering origin math so clicks land on the correct cell.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Element is replaced by two types: Behavior (a plain struct of runtime
properties: passable, opaque) and Archetype (an enum of named presets:
Empty, Wall, Object, ErrorBlock). Board.cells changes from Vec<(Glyph,
usize)> to Vec<(Glyph, Archetype)>, eliminating the per-board element
palette. Map files now reference archetypes by name (archetype = "wall")
instead of property bags (passable = false), so the archetype list can
be reordered without breaking saved games. Unknown archetype names
produce an ErrorBlock cell (yellow ? on red) so malformed maps are
immediately visible in-game.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All public types, fields, and functions in game.rs and map_file.rs now
have /// doc comments. main.rs has /// on App and draw_glyph plus inline
comments explaining the input/render pipeline. CLAUDE.md records the
expectation that generated code includes comments.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents the player-as-object goal and calls out the four specific
places in the current design (Board.player, player_start, try_move,
main.rs overlay) that will need to change when that's implemented.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents the module structure, key design decisions and their reasons,
map file format design, what's not yet implemented, and ZZT background
for future development sessions.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents all implemented modules, data structures, map file format,
and key design decisions made during this session.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces a map file format: TOML with a [palette] mapping characters
to (Glyph, Element) definitions and a [grid] multi-line string. Board
now owns the player position, objects, and portals. map_file::load()
deserializes a file and converts it to a Board via From<MapFile>.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Accounts for egui's 8px CentralPanel margin in the minimum window size.
When the window is larger than the minimum, the board is centered in the
available area.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements Glyph (per-cell visual), Element (shared behavior palette),
and Board (60x25 grid of (Glyph, usize) cells). Player walks around
with arrow keys and is blocked by wall elements.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sets up eframe/egui app with basic menu bar and placeholder viewport. Adds Rhai scripting dependency for future game object scripting system.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>