2024-04-20 10:32:04 -04:00
|
|
|
#include "UIGrid.h"
|
2026-01-10 22:09:45 -05:00
|
|
|
#include "UIGridPathfinding.h" // New pathfinding API
|
2024-04-20 10:32:04 -04:00
|
|
|
#include "GameEngine.h"
|
|
|
|
|
#include "McRFPy_API.h"
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
#include "PythonObjectCache.h"
|
2026-01-10 08:37:31 -05:00
|
|
|
#include "PyTypeCache.h" // Thread-safe cached Python types
|
2025-07-21 23:47:21 -04:00
|
|
|
#include "UIEntity.h"
|
feat: Add comprehensive profiling system with F3 overlay
Add real-time performance profiling infrastructure to monitor frame times,
render performance, and identify bottlenecks.
Features:
- Profiler.h: ScopedTimer RAII helper for automatic timing measurements
- ProfilerOverlay: F3-togglable overlay displaying real-time metrics
- Detailed timing breakdowns: grid rendering, entity rendering, FOV,
Python callbacks, and animation updates
- Per-frame counters: cells rendered, entities rendered, draw calls
- Performance color coding: green (<16ms), yellow (<33ms), red (>33ms)
- Benchmark suite: static grid and moving entities performance tests
Integration:
- GameEngine: Integrated profiler overlay with F3 toggle
- UIGrid: Added timing instrumentation for grid and entity rendering
- Metrics tracked in ProfilingMetrics struct with 60-frame averaging
Usage:
- Press F3 in-game to toggle profiler overlay
- Run benchmarks with tests/benchmark_*.py scripts
- ScopedTimer automatically measures code block execution time
This addresses issue #104 (Basic profiling/metrics).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 00:45:44 -04:00
|
|
|
#include "Profiler.h"
|
feat: Implement FOV enum and layer draw_fov for #114 and #113
Phase 1 - FOV Enum System:
- Create PyFOV.h/cpp with mcrfpy.FOV IntEnum (BASIC, DIAMOND, SHADOW, etc.)
- Add mcrfpy.default_fov module property initialized to FOV.BASIC
- Add grid.fov and grid.fov_radius properties for per-grid defaults
- Remove deprecated module-level FOV_* constants (breaking change)
Phase 2 - Layer Operations:
- Implement ColorLayer.fill_rect(pos, size, color) for rectangle fills
- Implement TileLayer.fill_rect(pos, size, index) for tile rectangle fills
- Implement ColorLayer.draw_fov(source, radius, fov, visible, discovered, unknown)
to paint FOV-based visibility on color layers using parent grid's TCOD map
The FOV enum uses Python's IntEnum for type safety while maintaining
backward compatibility with integer values. Tests updated to use new API.
Addresses #114 (FOV enum), #113 (layer operations)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 15:18:10 -05:00
|
|
|
#include "PyFOV.h"
|
2026-01-05 10:16:16 -05:00
|
|
|
#include "PyPositionHelper.h" // For standardized position argument parsing
|
Python API improvements: Vectors, bounds, window singleton, hidden types
- #177: GridPoint.grid_pos property returns (x, y) tuple
- #179: Grid.grid_size returns Vector instead of tuple
- #181: Grid.center returns Vector instead of tuple
- #182: Caption.size/w/h read-only properties for text dimensions
- #184: mcrfpy.window singleton for window access
- #185: Removed get_bounds() method, use .bounds property instead
- #188: bounds/global_bounds return (pos, size) as pair of Vectors
- #189: Hide internal types from module namespace (iterators, collections)
Also fixed critical bug: Changed static PyTypeObject to inline in headers
to ensure single instance across translation units (was causing segfaults).
Closes #177, closes #179, closes #181, closes #182, closes #184, closes #185, closes #188, closes #189
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 23:00:48 -05:00
|
|
|
#include "PyVector.h" // #179, #181 - For Vector return types
|
2026-01-11 20:42:47 -05:00
|
|
|
#include "PyHeightMap.h" // #199 - HeightMap application methods
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
#include <algorithm>
|
feat: Grid camera defaults to tile (0,0) at top-left + center_camera() method (#169)
Changes:
- Default Grid center now positions tile (0,0) at widget's top-left corner
- Added center_camera() method to center grid's middle tile at view center
- Added center_camera((tile_x, tile_y)) to position tile at top-left of widget
- Uses NaN as sentinel to detect if user provided center values in kwargs
- Animation-compatible: center_camera() just sets center property, no special state
Behavior:
- center_camera() → grid's center tile at view center
- center_camera((0, 0)) → tile (0,0) at top-left corner
- center_camera((5, 10)) → tile (5,10) at top-left corner
Before: Grid(size=(320,240)) showed 3/4 of content off-screen (center=0,0)
After: Grid(size=(320,240)) shows tile (0,0) at top-left (center=160,120)
Closes #169
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:30:51 -05:00
|
|
|
#include <cmath> // #142 - for std::floor, std::isnan
|
2025-11-28 23:04:09 -05:00
|
|
|
#include <cstring> // #150 - for strcmp
|
feat: Grid camera defaults to tile (0,0) at top-left + center_camera() method (#169)
Changes:
- Default Grid center now positions tile (0,0) at widget's top-left corner
- Added center_camera() method to center grid's middle tile at view center
- Added center_camera((tile_x, tile_y)) to position tile at top-left of widget
- Uses NaN as sentinel to detect if user provided center values in kwargs
- Animation-compatible: center_camera() just sets center property, no special state
Behavior:
- center_camera() → grid's center tile at view center
- center_camera((0, 0)) → tile (0,0) at top-left corner
- center_camera((5, 10)) → tile (5,10) at top-left corner
Before: Grid(size=(320,240)) showed 3/4 of content off-screen (center=0,0)
After: Grid(size=(320,240)) shows tile (0,0) at top-left (center=160,120)
Closes #169
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:30:51 -05:00
|
|
|
#include <limits> // #169 - for std::numeric_limits
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// UIDrawable methods now in UIBase.h
|
2026-01-10 08:37:31 -05:00
|
|
|
// UIEntityCollection code moved to UIEntityCollection.cpp
|
2024-04-20 10:32:04 -04:00
|
|
|
|
2025-11-28 22:33:16 -05:00
|
|
|
UIGrid::UIGrid()
|
2026-01-06 10:21:50 -05:00
|
|
|
: grid_w(0), grid_h(0), zoom(1.0f), center_x(0.0f), center_y(0.0f), ptex(nullptr),
|
2026-01-10 22:09:45 -05:00
|
|
|
fill_color(8, 8, 8, 255), tcod_map(nullptr),
|
feat: Implement FOV enum and layer draw_fov for #114 and #113
Phase 1 - FOV Enum System:
- Create PyFOV.h/cpp with mcrfpy.FOV IntEnum (BASIC, DIAMOND, SHADOW, etc.)
- Add mcrfpy.default_fov module property initialized to FOV.BASIC
- Add grid.fov and grid.fov_radius properties for per-grid defaults
- Remove deprecated module-level FOV_* constants (breaking change)
Phase 2 - Layer Operations:
- Implement ColorLayer.fill_rect(pos, size, color) for rectangle fills
- Implement TileLayer.fill_rect(pos, size, index) for tile rectangle fills
- Implement ColorLayer.draw_fov(source, radius, fov, visible, discovered, unknown)
to paint FOV-based visibility on color layers using parent grid's TCOD map
The FOV enum uses Python's IntEnum for type safety while maintaining
backward compatibility with integer values. Tests updated to use new API.
Addresses #114 (FOV enum), #113 (layer operations)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 15:18:10 -05:00
|
|
|
perspective_enabled(false), fov_algorithm(FOV_BASIC), fov_radius(10),
|
|
|
|
|
use_chunks(false) // Default to omniscient view
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
{
|
|
|
|
|
// Initialize entities list
|
|
|
|
|
entities = std::make_shared<std::list<std::shared_ptr<UIEntity>>>();
|
2025-11-25 21:52:37 -05:00
|
|
|
|
|
|
|
|
// Initialize children collection (for UIDrawables like speech bubbles, effects)
|
|
|
|
|
children = std::make_shared<std::vector<std::shared_ptr<UIDrawable>>>();
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Initialize box with safe defaults
|
|
|
|
|
box.setSize(sf::Vector2f(0, 0));
|
|
|
|
|
position = sf::Vector2f(0, 0); // Set base class position
|
|
|
|
|
box.setPosition(position); // Sync box position
|
|
|
|
|
box.setFillColor(sf::Color(0, 0, 0, 0));
|
2025-11-28 22:33:16 -05:00
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Initialize render texture (small default size)
|
|
|
|
|
renderTexture.create(1, 1);
|
2025-11-28 22:33:16 -05:00
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Initialize output sprite
|
|
|
|
|
output.setTextureRect(sf::IntRect(0, 0, 0, 0));
|
|
|
|
|
output.setPosition(0, 0);
|
|
|
|
|
output.setTexture(renderTexture.getTexture());
|
2025-11-28 22:33:16 -05:00
|
|
|
|
2026-01-06 10:21:50 -05:00
|
|
|
// Points vector starts empty (grid_w * grid_h = 0)
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// TCOD map will be created when grid is resized
|
|
|
|
|
}
|
2024-04-20 10:32:04 -04:00
|
|
|
|
|
|
|
|
UIGrid::UIGrid(int gx, int gy, std::shared_ptr<PyTexture> _ptex, sf::Vector2f _xy, sf::Vector2f _wh)
|
2026-01-06 10:21:50 -05:00
|
|
|
: grid_w(gx), grid_h(gy),
|
2025-11-28 22:33:16 -05:00
|
|
|
zoom(1.0f),
|
|
|
|
|
ptex(_ptex),
|
2026-01-10 22:09:45 -05:00
|
|
|
fill_color(8, 8, 8, 255), tcod_map(nullptr),
|
feat: Implement FOV enum and layer draw_fov for #114 and #113
Phase 1 - FOV Enum System:
- Create PyFOV.h/cpp with mcrfpy.FOV IntEnum (BASIC, DIAMOND, SHADOW, etc.)
- Add mcrfpy.default_fov module property initialized to FOV.BASIC
- Add grid.fov and grid.fov_radius properties for per-grid defaults
- Remove deprecated module-level FOV_* constants (breaking change)
Phase 2 - Layer Operations:
- Implement ColorLayer.fill_rect(pos, size, color) for rectangle fills
- Implement TileLayer.fill_rect(pos, size, index) for tile rectangle fills
- Implement ColorLayer.draw_fov(source, radius, fov, visible, discovered, unknown)
to paint FOV-based visibility on color layers using parent grid's TCOD map
The FOV enum uses Python's IntEnum for type safety while maintaining
backward compatibility with integer values. Tests updated to use new API.
Addresses #114 (FOV enum), #113 (layer operations)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 15:18:10 -05:00
|
|
|
perspective_enabled(false), fov_algorithm(FOV_BASIC), fov_radius(10),
|
2025-11-28 22:33:16 -05:00
|
|
|
use_chunks(gx > CHUNK_THRESHOLD || gy > CHUNK_THRESHOLD) // #123 - Use chunks for large grids
|
2024-04-20 10:32:04 -04:00
|
|
|
{
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
// Use texture dimensions if available, otherwise use defaults
|
|
|
|
|
int cell_width = _ptex ? _ptex->sprite_width : DEFAULT_CELL_WIDTH;
|
|
|
|
|
int cell_height = _ptex ? _ptex->sprite_height : DEFAULT_CELL_HEIGHT;
|
2025-11-28 22:33:16 -05:00
|
|
|
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
center_x = (gx/2) * cell_width;
|
|
|
|
|
center_y = (gy/2) * cell_height;
|
2024-04-20 10:32:04 -04:00
|
|
|
entities = std::make_shared<std::list<std::shared_ptr<UIEntity>>>();
|
|
|
|
|
|
2025-11-25 21:52:37 -05:00
|
|
|
// Initialize children collection (for UIDrawables like speech bubbles, effects)
|
|
|
|
|
children = std::make_shared<std::vector<std::shared_ptr<UIDrawable>>>();
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
box.setSize(_wh);
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
position = _xy; // Set base class position
|
2025-11-28 22:33:16 -05:00
|
|
|
box.setPosition(position); // Sync box position
|
2024-04-20 10:32:04 -04:00
|
|
|
|
|
|
|
|
box.setFillColor(sf::Color(0,0,0,0));
|
|
|
|
|
// create renderTexture with maximum theoretical size; sprite can resize to show whatever amount needs to be rendered
|
|
|
|
|
renderTexture.create(1920, 1080); // TODO - renderTexture should be window size; above 1080p this will cause rendering errors
|
2025-11-28 22:33:16 -05:00
|
|
|
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
// Only initialize sprite if texture is available
|
|
|
|
|
if (ptex) {
|
|
|
|
|
sprite = ptex->sprite(0);
|
|
|
|
|
}
|
2024-04-20 10:32:04 -04:00
|
|
|
|
|
|
|
|
output.setTextureRect(
|
|
|
|
|
sf::IntRect(0, 0,
|
|
|
|
|
box.getSize().x, box.getSize().y));
|
|
|
|
|
output.setPosition(box.getPosition());
|
|
|
|
|
// textures are upside-down inside renderTexture
|
|
|
|
|
output.setTexture(renderTexture.getTexture());
|
|
|
|
|
|
2026-01-10 22:09:45 -05:00
|
|
|
// Create TCOD map for FOV and as source for pathfinding
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
tcod_map = new TCODMap(gx, gy);
|
2026-01-10 22:09:45 -05:00
|
|
|
// Note: DijkstraMap objects are created on-demand via get_dijkstra_map()
|
|
|
|
|
// A* paths are computed on-demand via find_path()
|
2025-11-28 22:33:16 -05:00
|
|
|
|
|
|
|
|
// #123 - Initialize storage based on grid size
|
|
|
|
|
if (use_chunks) {
|
|
|
|
|
// Large grid: use chunk-based storage
|
|
|
|
|
chunk_manager = std::make_unique<ChunkManager>(gx, gy, this);
|
|
|
|
|
|
|
|
|
|
// Initialize all cells with parent reference
|
|
|
|
|
for (int cy = 0; cy < chunk_manager->chunks_y; ++cy) {
|
|
|
|
|
for (int cx = 0; cx < chunk_manager->chunks_x; ++cx) {
|
|
|
|
|
GridChunk* chunk = chunk_manager->getChunk(cx, cy);
|
|
|
|
|
if (!chunk) continue;
|
|
|
|
|
|
|
|
|
|
for (int ly = 0; ly < chunk->height; ++ly) {
|
|
|
|
|
for (int lx = 0; lx < chunk->width; ++lx) {
|
|
|
|
|
auto& cell = chunk->at(lx, ly);
|
|
|
|
|
cell.grid_x = chunk->world_x + lx;
|
|
|
|
|
cell.grid_y = chunk->world_y + ly;
|
|
|
|
|
cell.parent_grid = this;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Small grid: use flat storage (original behavior)
|
|
|
|
|
points.resize(gx * gy);
|
|
|
|
|
for (int y = 0; y < gy; y++) {
|
|
|
|
|
for (int x = 0; x < gx; x++) {
|
|
|
|
|
int idx = y * gx + x;
|
|
|
|
|
points[idx].grid_x = x;
|
|
|
|
|
points[idx].grid_y = y;
|
|
|
|
|
points[idx].parent_grid = this;
|
|
|
|
|
}
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
}
|
|
|
|
|
}
|
2025-11-28 22:33:16 -05:00
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Initial sync of TCOD map
|
|
|
|
|
syncTCODMap();
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UIGrid::update() {}
|
|
|
|
|
|
|
|
|
|
|
2025-03-05 20:21:24 -05:00
|
|
|
void UIGrid::render(sf::Vector2f offset, sf::RenderTarget& target)
|
2024-04-20 10:32:04 -04:00
|
|
|
{
|
feat: Add comprehensive profiling system with F3 overlay
Add real-time performance profiling infrastructure to monitor frame times,
render performance, and identify bottlenecks.
Features:
- Profiler.h: ScopedTimer RAII helper for automatic timing measurements
- ProfilerOverlay: F3-togglable overlay displaying real-time metrics
- Detailed timing breakdowns: grid rendering, entity rendering, FOV,
Python callbacks, and animation updates
- Per-frame counters: cells rendered, entities rendered, draw calls
- Performance color coding: green (<16ms), yellow (<33ms), red (>33ms)
- Benchmark suite: static grid and moving entities performance tests
Integration:
- GameEngine: Integrated profiler overlay with F3 toggle
- UIGrid: Added timing instrumentation for grid and entity rendering
- Metrics tracked in ProfilingMetrics struct with 60-frame averaging
Usage:
- Press F3 in-game to toggle profiler overlay
- Run benchmarks with tests/benchmark_*.py scripts
- ScopedTimer automatically measures code block execution time
This addresses issue #104 (Basic profiling/metrics).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 00:45:44 -04:00
|
|
|
// Profile total grid rendering time
|
|
|
|
|
ScopedTimer gridTimer(Resources::game->metrics.gridRenderTime);
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Check visibility
|
|
|
|
|
if (!visible) return;
|
feat: Add comprehensive profiling system with F3 overlay
Add real-time performance profiling infrastructure to monitor frame times,
render performance, and identify bottlenecks.
Features:
- Profiler.h: ScopedTimer RAII helper for automatic timing measurements
- ProfilerOverlay: F3-togglable overlay displaying real-time metrics
- Detailed timing breakdowns: grid rendering, entity rendering, FOV,
Python callbacks, and animation updates
- Per-frame counters: cells rendered, entities rendered, draw calls
- Performance color coding: green (<16ms), yellow (<33ms), red (>33ms)
- Benchmark suite: static grid and moving entities performance tests
Integration:
- GameEngine: Integrated profiler overlay with F3 toggle
- UIGrid: Added timing instrumentation for grid and entity rendering
- Metrics tracked in ProfilingMetrics struct with 60-frame averaging
Usage:
- Press F3 in-game to toggle profiler overlay
- Run benchmarks with tests/benchmark_*.py scripts
- ScopedTimer automatically measures code block execution time
This addresses issue #104 (Basic profiling/metrics).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 00:45:44 -04:00
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// TODO: Apply opacity to output sprite
|
feat: Add comprehensive profiling system with F3 overlay
Add real-time performance profiling infrastructure to monitor frame times,
render performance, and identify bottlenecks.
Features:
- Profiler.h: ScopedTimer RAII helper for automatic timing measurements
- ProfilerOverlay: F3-togglable overlay displaying real-time metrics
- Detailed timing breakdowns: grid rendering, entity rendering, FOV,
Python callbacks, and animation updates
- Per-frame counters: cells rendered, entities rendered, draw calls
- Performance color coding: green (<16ms), yellow (<33ms), red (>33ms)
- Benchmark suite: static grid and moving entities performance tests
Integration:
- GameEngine: Integrated profiler overlay with F3 toggle
- UIGrid: Added timing instrumentation for grid and entity rendering
- Metrics tracked in ProfilingMetrics struct with 60-frame averaging
Usage:
- Press F3 in-game to toggle profiler overlay
- Run benchmarks with tests/benchmark_*.py scripts
- ScopedTimer automatically measures code block execution time
This addresses issue #104 (Basic profiling/metrics).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 00:45:44 -04:00
|
|
|
|
2025-03-05 20:21:24 -05:00
|
|
|
output.setPosition(box.getPosition() + offset); // output sprite can move; update position when drawing
|
2024-04-20 10:32:04 -04:00
|
|
|
// output size can change; update size when drawing
|
|
|
|
|
output.setTextureRect(
|
|
|
|
|
sf::IntRect(0, 0,
|
|
|
|
|
box.getSize().x, box.getSize().y));
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
renderTexture.clear(fill_color);
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
|
|
|
|
|
// Get cell dimensions - use texture if available, otherwise defaults
|
|
|
|
|
int cell_width = ptex ? ptex->sprite_width : DEFAULT_CELL_WIDTH;
|
|
|
|
|
int cell_height = ptex ? ptex->sprite_height : DEFAULT_CELL_HEIGHT;
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
// sprites that are visible according to zoom, center_x, center_y, and box width
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
float center_x_sq = center_x / cell_width;
|
|
|
|
|
float center_y_sq = center_y / cell_height;
|
2024-04-20 10:32:04 -04:00
|
|
|
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
float width_sq = box.getSize().x / (cell_width * zoom);
|
|
|
|
|
float height_sq = box.getSize().y / (cell_height * zoom);
|
2024-04-20 10:32:04 -04:00
|
|
|
float left_edge = center_x_sq - (width_sq / 2.0);
|
|
|
|
|
float top_edge = center_y_sq - (height_sq / 2.0);
|
|
|
|
|
|
|
|
|
|
int left_spritepixels = center_x - (box.getSize().x / 2.0 / zoom);
|
|
|
|
|
int top_spritepixels = center_y - (box.getSize().y / 2.0 / zoom);
|
|
|
|
|
|
|
|
|
|
int x_limit = left_edge + width_sq + 2;
|
2026-01-06 10:21:50 -05:00
|
|
|
if (x_limit > grid_w) x_limit = grid_w;
|
2024-04-20 10:32:04 -04:00
|
|
|
|
|
|
|
|
int y_limit = top_edge + height_sq + 2;
|
2026-01-06 10:21:50 -05:00
|
|
|
if (y_limit > grid_h) y_limit = grid_h;
|
2024-04-20 10:32:04 -04:00
|
|
|
|
2025-11-28 23:04:09 -05:00
|
|
|
// #150 - Layers are now the sole source of grid rendering (base layer removed)
|
|
|
|
|
// Render layers with z_index < 0 (below entities)
|
2025-11-28 21:35:38 -05:00
|
|
|
sortLayers();
|
|
|
|
|
for (auto& layer : layers) {
|
|
|
|
|
if (layer->z_index >= 0) break; // Stop at layers that go above entities
|
|
|
|
|
layer->render(renderTexture, left_spritepixels, top_spritepixels,
|
|
|
|
|
left_edge, top_edge, x_limit, y_limit, zoom, cell_width, cell_height);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
// middle layer - entities
|
|
|
|
|
// disabling entity rendering until I can render their UISprite inside the rendertexture (not directly to window)
|
feat: Add comprehensive profiling system with F3 overlay
Add real-time performance profiling infrastructure to monitor frame times,
render performance, and identify bottlenecks.
Features:
- Profiler.h: ScopedTimer RAII helper for automatic timing measurements
- ProfilerOverlay: F3-togglable overlay displaying real-time metrics
- Detailed timing breakdowns: grid rendering, entity rendering, FOV,
Python callbacks, and animation updates
- Per-frame counters: cells rendered, entities rendered, draw calls
- Performance color coding: green (<16ms), yellow (<33ms), red (>33ms)
- Benchmark suite: static grid and moving entities performance tests
Integration:
- GameEngine: Integrated profiler overlay with F3 toggle
- UIGrid: Added timing instrumentation for grid and entity rendering
- Metrics tracked in ProfilingMetrics struct with 60-frame averaging
Usage:
- Press F3 in-game to toggle profiler overlay
- Run benchmarks with tests/benchmark_*.py scripts
- ScopedTimer automatically measures code block execution time
This addresses issue #104 (Basic profiling/metrics).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 00:45:44 -04:00
|
|
|
{
|
|
|
|
|
ScopedTimer entityTimer(Resources::game->metrics.entityRenderTime);
|
|
|
|
|
int entitiesRendered = 0;
|
|
|
|
|
int totalEntities = entities->size();
|
|
|
|
|
|
|
|
|
|
for (auto e : *entities) {
|
|
|
|
|
// Skip out-of-bounds entities for performance
|
|
|
|
|
// Check if entity is within visible bounds (with 1 cell margin for partially visible entities)
|
|
|
|
|
if (e->position.x < left_edge - 1 || e->position.x >= left_edge + width_sq + 1 ||
|
|
|
|
|
e->position.y < top_edge - 1 || e->position.y >= top_edge + height_sq + 1) {
|
|
|
|
|
continue; // Skip this entity as it's not visible
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//auto drawent = e->cGrid->indexsprite.drawable();
|
|
|
|
|
auto& drawent = e->sprite;
|
|
|
|
|
//drawent.setScale(zoom, zoom);
|
|
|
|
|
drawent.setScale(sf::Vector2f(zoom, zoom));
|
|
|
|
|
auto pixel_pos = sf::Vector2f(
|
|
|
|
|
(e->position.x*cell_width - left_spritepixels) * zoom,
|
|
|
|
|
(e->position.y*cell_height - top_spritepixels) * zoom );
|
|
|
|
|
//drawent.setPosition(pixel_pos);
|
|
|
|
|
//renderTexture.draw(drawent);
|
|
|
|
|
drawent.render(pixel_pos, renderTexture);
|
|
|
|
|
|
|
|
|
|
entitiesRendered++;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
}
|
feat: Add comprehensive profiling system with F3 overlay
Add real-time performance profiling infrastructure to monitor frame times,
render performance, and identify bottlenecks.
Features:
- Profiler.h: ScopedTimer RAII helper for automatic timing measurements
- ProfilerOverlay: F3-togglable overlay displaying real-time metrics
- Detailed timing breakdowns: grid rendering, entity rendering, FOV,
Python callbacks, and animation updates
- Per-frame counters: cells rendered, entities rendered, draw calls
- Performance color coding: green (<16ms), yellow (<33ms), red (>33ms)
- Benchmark suite: static grid and moving entities performance tests
Integration:
- GameEngine: Integrated profiler overlay with F3 toggle
- UIGrid: Added timing instrumentation for grid and entity rendering
- Metrics tracked in ProfilingMetrics struct with 60-frame averaging
Usage:
- Press F3 in-game to toggle profiler overlay
- Run benchmarks with tests/benchmark_*.py scripts
- ScopedTimer automatically measures code block execution time
This addresses issue #104 (Basic profiling/metrics).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 00:45:44 -04:00
|
|
|
|
|
|
|
|
// Record entity rendering stats
|
|
|
|
|
Resources::game->metrics.entitiesRendered += entitiesRendered;
|
|
|
|
|
Resources::game->metrics.totalEntities += totalEntities;
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
2025-11-25 21:52:37 -05:00
|
|
|
|
2025-11-28 21:35:38 -05:00
|
|
|
// #147 - Render dynamic layers with z_index >= 0 (above entities)
|
|
|
|
|
for (auto& layer : layers) {
|
|
|
|
|
if (layer->z_index < 0) continue; // Skip layers below entities
|
|
|
|
|
layer->render(renderTexture, left_spritepixels, top_spritepixels,
|
|
|
|
|
left_edge, top_edge, x_limit, y_limit, zoom, cell_width, cell_height);
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-25 21:52:37 -05:00
|
|
|
// Children layer - UIDrawables in grid-world pixel coordinates
|
|
|
|
|
// Positioned between entities and FOV overlay for proper z-ordering
|
|
|
|
|
if (children && !children->empty()) {
|
|
|
|
|
// Sort by z_index if needed
|
|
|
|
|
if (children_need_sort) {
|
|
|
|
|
std::sort(children->begin(), children->end(),
|
|
|
|
|
[](const auto& a, const auto& b) { return a->z_index < b->z_index; });
|
|
|
|
|
children_need_sort = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto& child : *children) {
|
|
|
|
|
if (!child->visible) continue;
|
|
|
|
|
|
|
|
|
|
// Cull children outside visible region (convert pixel pos to cell coords)
|
|
|
|
|
float child_grid_x = child->position.x / cell_width;
|
|
|
|
|
float child_grid_y = child->position.y / cell_height;
|
|
|
|
|
|
|
|
|
|
if (child_grid_x < left_edge - 2 || child_grid_x >= left_edge + width_sq + 2 ||
|
|
|
|
|
child_grid_y < top_edge - 2 || child_grid_y >= top_edge + height_sq + 2) {
|
|
|
|
|
continue; // Not visible, skip rendering
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Transform grid-world pixel position to RenderTexture pixel position
|
|
|
|
|
auto pixel_pos = sf::Vector2f(
|
|
|
|
|
(child->position.x - left_spritepixels) * zoom,
|
|
|
|
|
(child->position.y - top_spritepixels) * zoom
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
child->render(pixel_pos, renderTexture);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-20 10:32:04 -04:00
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// top layer - opacity for discovered / visible status based on perspective
|
2025-07-21 23:47:21 -04:00
|
|
|
// Only render visibility overlay if perspective is enabled
|
|
|
|
|
if (perspective_enabled) {
|
feat: Add comprehensive profiling system with F3 overlay
Add real-time performance profiling infrastructure to monitor frame times,
render performance, and identify bottlenecks.
Features:
- Profiler.h: ScopedTimer RAII helper for automatic timing measurements
- ProfilerOverlay: F3-togglable overlay displaying real-time metrics
- Detailed timing breakdowns: grid rendering, entity rendering, FOV,
Python callbacks, and animation updates
- Per-frame counters: cells rendered, entities rendered, draw calls
- Performance color coding: green (<16ms), yellow (<33ms), red (>33ms)
- Benchmark suite: static grid and moving entities performance tests
Integration:
- GameEngine: Integrated profiler overlay with F3 toggle
- UIGrid: Added timing instrumentation for grid and entity rendering
- Metrics tracked in ProfilingMetrics struct with 60-frame averaging
Usage:
- Press F3 in-game to toggle profiler overlay
- Run benchmarks with tests/benchmark_*.py scripts
- ScopedTimer automatically measures code block execution time
This addresses issue #104 (Basic profiling/metrics).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-25 00:45:44 -04:00
|
|
|
ScopedTimer fovTimer(Resources::game->metrics.fovOverlayTime);
|
2025-07-21 23:47:21 -04:00
|
|
|
auto entity = perspective_entity.lock();
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
|
|
|
|
|
// Create rectangle for overlays
|
|
|
|
|
sf::RectangleShape overlay;
|
|
|
|
|
overlay.setSize(sf::Vector2f(cell_width * zoom, cell_height * zoom));
|
|
|
|
|
|
2025-07-21 23:47:21 -04:00
|
|
|
if (entity) {
|
|
|
|
|
// Valid entity - use its gridstate for visibility
|
|
|
|
|
for (int x = (left_edge - 1 >= 0 ? left_edge - 1 : 0);
|
|
|
|
|
x < x_limit;
|
|
|
|
|
x+=1)
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
{
|
2025-07-21 23:47:21 -04:00
|
|
|
for (int y = (top_edge - 1 >= 0 ? top_edge - 1 : 0);
|
|
|
|
|
y < y_limit;
|
|
|
|
|
y+=1)
|
|
|
|
|
{
|
|
|
|
|
// Skip out-of-bounds cells
|
2026-01-06 10:21:50 -05:00
|
|
|
if (x < 0 || x >= grid_w || y < 0 || y >= grid_h) continue;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
|
2025-07-21 23:47:21 -04:00
|
|
|
auto pixel_pos = sf::Vector2f(
|
|
|
|
|
(x*cell_width - left_spritepixels) * zoom,
|
|
|
|
|
(y*cell_height - top_spritepixels) * zoom );
|
|
|
|
|
|
|
|
|
|
// Get visibility state from entity's perspective
|
2026-01-06 10:21:50 -05:00
|
|
|
int idx = y * grid_w + x;
|
2025-07-21 23:47:21 -04:00
|
|
|
if (idx >= 0 && idx < static_cast<int>(entity->gridstate.size())) {
|
|
|
|
|
const auto& state = entity->gridstate[idx];
|
|
|
|
|
|
|
|
|
|
overlay.setPosition(pixel_pos);
|
|
|
|
|
|
|
|
|
|
// Three overlay colors as specified:
|
|
|
|
|
if (!state.discovered) {
|
|
|
|
|
// Never seen - black
|
|
|
|
|
overlay.setFillColor(sf::Color(0, 0, 0, 255));
|
|
|
|
|
renderTexture.draw(overlay);
|
|
|
|
|
} else if (!state.visible) {
|
|
|
|
|
// Discovered but not currently visible - dark gray
|
|
|
|
|
overlay.setFillColor(sf::Color(32, 32, 40, 192));
|
|
|
|
|
renderTexture.draw(overlay);
|
|
|
|
|
}
|
|
|
|
|
// If visible and discovered, no overlay (fully visible)
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
}
|
2025-07-21 23:47:21 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Invalid/destroyed entity with perspective_enabled = true
|
|
|
|
|
// Show all cells as undiscovered (black)
|
|
|
|
|
for (int x = (left_edge - 1 >= 0 ? left_edge - 1 : 0);
|
|
|
|
|
x < x_limit;
|
|
|
|
|
x+=1)
|
|
|
|
|
{
|
|
|
|
|
for (int y = (top_edge - 1 >= 0 ? top_edge - 1 : 0);
|
|
|
|
|
y < y_limit;
|
|
|
|
|
y+=1)
|
|
|
|
|
{
|
|
|
|
|
// Skip out-of-bounds cells
|
2026-01-06 10:21:50 -05:00
|
|
|
if (x < 0 || x >= grid_w || y < 0 || y >= grid_h) continue;
|
2025-07-21 23:47:21 -04:00
|
|
|
|
|
|
|
|
auto pixel_pos = sf::Vector2f(
|
|
|
|
|
(x*cell_width - left_spritepixels) * zoom,
|
|
|
|
|
(y*cell_height - top_spritepixels) * zoom );
|
|
|
|
|
|
|
|
|
|
overlay.setPosition(pixel_pos);
|
|
|
|
|
overlay.setFillColor(sf::Color(0, 0, 0, 255));
|
|
|
|
|
renderTexture.draw(overlay);
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
}
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-21 23:47:21 -04:00
|
|
|
// else: omniscient view (no overlays)
|
2024-04-20 10:32:04 -04:00
|
|
|
|
|
|
|
|
// grid lines for testing & validation
|
|
|
|
|
/*
|
|
|
|
|
sf::Vertex line[] =
|
|
|
|
|
{
|
|
|
|
|
sf::Vertex(sf::Vector2f(0, 0), sf::Color::Red),
|
|
|
|
|
sf::Vertex(box.getSize(), sf::Color::Red),
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
renderTexture.draw(line, 2, sf::Lines);
|
|
|
|
|
sf::Vertex lineb[] =
|
|
|
|
|
{
|
|
|
|
|
sf::Vertex(sf::Vector2f(0, box.getSize().y), sf::Color::Blue),
|
|
|
|
|
sf::Vertex(sf::Vector2f(box.getSize().x, 0), sf::Color::Blue),
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
renderTexture.draw(lineb, 2, sf::Lines);
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// render to window
|
|
|
|
|
renderTexture.display();
|
2025-03-05 20:21:24 -05:00
|
|
|
//Resources::game->getWindow().draw(output);
|
|
|
|
|
target.draw(output);
|
2024-04-20 10:32:04 -04:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UIGridPoint& UIGrid::at(int x, int y)
|
|
|
|
|
{
|
2025-11-28 22:33:16 -05:00
|
|
|
// #123 - Route through chunk manager for large grids
|
|
|
|
|
if (use_chunks && chunk_manager) {
|
|
|
|
|
return chunk_manager->at(x, y);
|
|
|
|
|
}
|
2026-01-06 10:21:50 -05:00
|
|
|
return points[y * grid_w + x];
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
UIGrid::~UIGrid()
|
|
|
|
|
{
|
2026-01-10 22:09:45 -05:00
|
|
|
// Clear Dijkstra maps first (they reference tcod_map)
|
|
|
|
|
dijkstra_maps.clear();
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
if (tcod_map) {
|
|
|
|
|
delete tcod_map;
|
|
|
|
|
tcod_map = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
PyObjectsEnum UIGrid::derived_type()
|
|
|
|
|
{
|
|
|
|
|
return PyObjectsEnum::UIGRID;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-28 21:35:38 -05:00
|
|
|
// #147 - Layer management methods
|
2025-11-28 23:04:09 -05:00
|
|
|
std::shared_ptr<ColorLayer> UIGrid::addColorLayer(int z_index, const std::string& name) {
|
2026-01-06 10:21:50 -05:00
|
|
|
auto layer = std::make_shared<ColorLayer>(z_index, grid_w, grid_h, this);
|
2025-11-28 23:04:09 -05:00
|
|
|
layer->name = name;
|
2025-11-28 21:35:38 -05:00
|
|
|
layers.push_back(layer);
|
|
|
|
|
layers_need_sort = true;
|
|
|
|
|
return layer;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-28 23:04:09 -05:00
|
|
|
std::shared_ptr<TileLayer> UIGrid::addTileLayer(int z_index, std::shared_ptr<PyTexture> texture, const std::string& name) {
|
2026-01-06 10:21:50 -05:00
|
|
|
auto layer = std::make_shared<TileLayer>(z_index, grid_w, grid_h, this, texture);
|
2025-11-28 23:04:09 -05:00
|
|
|
layer->name = name;
|
2025-11-28 21:35:38 -05:00
|
|
|
layers.push_back(layer);
|
|
|
|
|
layers_need_sort = true;
|
|
|
|
|
return layer;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-28 23:04:09 -05:00
|
|
|
std::shared_ptr<GridLayer> UIGrid::getLayerByName(const std::string& name) {
|
|
|
|
|
for (auto& layer : layers) {
|
|
|
|
|
if (layer->name == name) {
|
|
|
|
|
return layer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UIGrid::isProtectedLayerName(const std::string& name) {
|
2025-11-28 23:21:39 -05:00
|
|
|
// #150 - These names are reserved for GridPoint pathfinding properties
|
2025-11-28 23:04:09 -05:00
|
|
|
static const std::vector<std::string> protected_names = {
|
2025-11-28 23:21:39 -05:00
|
|
|
"walkable", "transparent"
|
2025-11-28 23:04:09 -05:00
|
|
|
};
|
|
|
|
|
for (const auto& pn : protected_names) {
|
|
|
|
|
if (name == pn) return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-28 21:35:38 -05:00
|
|
|
void UIGrid::removeLayer(std::shared_ptr<GridLayer> layer) {
|
|
|
|
|
auto it = std::find(layers.begin(), layers.end(), layer);
|
|
|
|
|
if (it != layers.end()) {
|
|
|
|
|
layers.erase(it);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UIGrid::sortLayers() {
|
|
|
|
|
if (layers_need_sort) {
|
|
|
|
|
std::sort(layers.begin(), layers.end(),
|
|
|
|
|
[](const auto& a, const auto& b) { return a->z_index < b->z_index; });
|
|
|
|
|
layers_need_sort = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// TCOD integration methods
|
|
|
|
|
void UIGrid::syncTCODMap()
|
|
|
|
|
{
|
|
|
|
|
if (!tcod_map) return;
|
|
|
|
|
|
2026-01-06 10:21:50 -05:00
|
|
|
for (int y = 0; y < grid_h; y++) {
|
|
|
|
|
for (int x = 0; x < grid_w; x++) {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
const UIGridPoint& point = at(x, y);
|
|
|
|
|
tcod_map->setProperties(x, y, point.transparent, point.walkable);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UIGrid::syncTCODMapCell(int x, int y)
|
|
|
|
|
{
|
2026-01-06 10:21:50 -05:00
|
|
|
if (!tcod_map || x < 0 || x >= grid_w || y < 0 || y >= grid_h) return;
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
const UIGridPoint& point = at(x, y);
|
|
|
|
|
tcod_map->setProperties(x, y, point.transparent, point.walkable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UIGrid::computeFOV(int x, int y, int radius, bool light_walls, TCOD_fov_algorithm_t algo)
|
|
|
|
|
{
|
2026-01-06 10:21:50 -05:00
|
|
|
if (!tcod_map || x < 0 || x >= grid_w || y < 0 || y >= grid_h) return;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
|
2025-07-22 23:00:34 -04:00
|
|
|
std::lock_guard<std::mutex> lock(fov_mutex);
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
tcod_map->computeFov(x, y, radius, light_walls, algo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UIGrid::isInFOV(int x, int y) const
|
|
|
|
|
{
|
2026-01-06 10:21:50 -05:00
|
|
|
if (!tcod_map || x < 0 || x >= grid_w || y < 0 || y >= grid_h) return false;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
|
2025-07-22 23:00:34 -04:00
|
|
|
std::lock_guard<std::mutex> lock(fov_mutex);
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return tcod_map->isInFov(x, y);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-10 22:09:45 -05:00
|
|
|
// Pathfinding methods moved to UIGridPathfinding.cpp
|
|
|
|
|
// - Grid.find_path() returns AStarPath objects
|
|
|
|
|
// - Grid.get_dijkstra_map() returns DijkstraMap objects (cached)
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
|
|
|
|
|
// Phase 1 implementations
|
|
|
|
|
sf::FloatRect UIGrid::get_bounds() const
|
|
|
|
|
{
|
|
|
|
|
auto size = box.getSize();
|
|
|
|
|
return sf::FloatRect(position.x, position.y, size.x, size.y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UIGrid::move(float dx, float dy)
|
|
|
|
|
{
|
|
|
|
|
position.x += dx;
|
|
|
|
|
position.y += dy;
|
|
|
|
|
box.setPosition(position); // Keep box in sync
|
|
|
|
|
output.setPosition(position); // Keep output sprite in sync too
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UIGrid::resize(float w, float h)
|
|
|
|
|
{
|
|
|
|
|
box.setSize(sf::Vector2f(w, h));
|
|
|
|
|
// Recreate render texture with new size
|
|
|
|
|
if (w > 0 && h > 0) {
|
|
|
|
|
renderTexture.create(static_cast<unsigned int>(w), static_cast<unsigned int>(h));
|
|
|
|
|
output.setTexture(renderTexture.getTexture());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UIGrid::onPositionChanged()
|
|
|
|
|
{
|
|
|
|
|
// Sync box and output sprite positions with base class position
|
|
|
|
|
box.setPosition(position);
|
|
|
|
|
output.setPosition(position);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
std::shared_ptr<PyTexture> UIGrid::getTexture()
|
|
|
|
|
{
|
|
|
|
|
return ptex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UIDrawable* UIGrid::click_at(sf::Vector2f point)
|
|
|
|
|
{
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Check grid bounds first
|
|
|
|
|
if (!box.getGlobalBounds().contains(point)) {
|
|
|
|
|
return nullptr;
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
|
|
|
|
|
// Transform to local coordinates
|
|
|
|
|
sf::Vector2f localPoint = point - box.getPosition();
|
|
|
|
|
|
|
|
|
|
// Get cell dimensions
|
|
|
|
|
int cell_width = ptex ? ptex->sprite_width : DEFAULT_CELL_WIDTH;
|
|
|
|
|
int cell_height = ptex ? ptex->sprite_height : DEFAULT_CELL_HEIGHT;
|
|
|
|
|
|
|
|
|
|
// Calculate visible area parameters (from render function)
|
|
|
|
|
float center_x_sq = center_x / cell_width;
|
|
|
|
|
float center_y_sq = center_y / cell_height;
|
|
|
|
|
float width_sq = box.getSize().x / (cell_width * zoom);
|
|
|
|
|
float height_sq = box.getSize().y / (cell_height * zoom);
|
|
|
|
|
|
|
|
|
|
int left_spritepixels = center_x - (box.getSize().x / 2.0 / zoom);
|
|
|
|
|
int top_spritepixels = center_y - (box.getSize().y / 2.0 / zoom);
|
|
|
|
|
|
2025-11-25 21:52:37 -05:00
|
|
|
// Convert click position to grid-world pixel coordinates
|
|
|
|
|
float grid_world_x = localPoint.x / zoom + left_spritepixels;
|
|
|
|
|
float grid_world_y = localPoint.y / zoom + top_spritepixels;
|
|
|
|
|
|
|
|
|
|
// Convert to grid cell coordinates
|
|
|
|
|
float grid_x = grid_world_x / cell_width;
|
|
|
|
|
float grid_y = grid_world_y / cell_height;
|
|
|
|
|
|
|
|
|
|
// Check children first (they render on top, so they get priority)
|
|
|
|
|
// Children are positioned in grid-world pixel coordinates
|
|
|
|
|
if (children && !children->empty()) {
|
|
|
|
|
// Check in reverse z-order (highest z_index first, rendered last = on top)
|
|
|
|
|
for (auto it = children->rbegin(); it != children->rend(); ++it) {
|
|
|
|
|
auto& child = *it;
|
|
|
|
|
if (!child->visible) continue;
|
|
|
|
|
|
|
|
|
|
// Transform click to child's local coordinate space
|
|
|
|
|
// Children's position is in grid-world pixels
|
|
|
|
|
sf::Vector2f childLocalPoint = sf::Vector2f(grid_world_x, grid_world_y);
|
|
|
|
|
|
|
|
|
|
if (auto target = child->click_at(childLocalPoint)) {
|
|
|
|
|
return target;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Check entities in reverse order (assuming they should be checked top to bottom)
|
|
|
|
|
// Note: entities list is not sorted by z-index currently, but we iterate in reverse
|
|
|
|
|
// to match the render order assumption
|
|
|
|
|
if (entities) {
|
|
|
|
|
for (auto it = entities->rbegin(); it != entities->rend(); ++it) {
|
|
|
|
|
auto& entity = *it;
|
|
|
|
|
if (!entity || !entity->sprite.visible) continue;
|
|
|
|
|
|
|
|
|
|
// Check if click is within entity's grid cell
|
|
|
|
|
// Entities occupy a 1x1 grid cell centered on their position
|
|
|
|
|
float dx = grid_x - entity->position.x;
|
|
|
|
|
float dy = grid_y - entity->position.y;
|
|
|
|
|
|
|
|
|
|
if (dx >= -0.5f && dx < 0.5f && dy >= -0.5f && dy < 0.5f) {
|
|
|
|
|
// Click is within the entity's cell
|
|
|
|
|
// Check if entity sprite has a click handler
|
|
|
|
|
// For now, we return the entity's sprite as the click target
|
|
|
|
|
// Note: UIEntity doesn't derive from UIDrawable, so we check its sprite
|
|
|
|
|
if (entity->sprite.click_callable) {
|
|
|
|
|
return &entity->sprite;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// No entity handled it, check if grid itself has handler
|
2026-01-09 21:37:23 -05:00
|
|
|
// #184: Also check for Python subclass (might have on_click method)
|
|
|
|
|
if (click_callable || is_python_subclass) {
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
// #142 - Fire on_cell_click if we have the callback and clicked on a valid cell
|
|
|
|
|
if (on_cell_click_callable) {
|
|
|
|
|
int cell_x = static_cast<int>(std::floor(grid_x));
|
|
|
|
|
int cell_y = static_cast<int>(std::floor(grid_y));
|
|
|
|
|
|
|
|
|
|
// Only fire if within valid grid bounds
|
2026-01-06 10:21:50 -05:00
|
|
|
if (cell_x >= 0 && cell_x < this->grid_w && cell_y >= 0 && cell_y < this->grid_h) {
|
2026-01-05 10:31:41 -05:00
|
|
|
// Create Vector object for cell position - must fetch finalized type from module
|
|
|
|
|
PyObject* vector_type = PyObject_GetAttrString(McRFPy_API::mcrf_module, "Vector");
|
|
|
|
|
if (vector_type) {
|
|
|
|
|
PyObject* cell_pos = PyObject_CallFunction(vector_type, "ff", (float)cell_x, (float)cell_y);
|
|
|
|
|
Py_DECREF(vector_type);
|
|
|
|
|
if (cell_pos) {
|
|
|
|
|
PyObject* args = Py_BuildValue("(O)", cell_pos);
|
|
|
|
|
Py_DECREF(cell_pos);
|
|
|
|
|
PyObject* result = PyObject_CallObject(on_cell_click_callable->borrow(), args);
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
if (!result) {
|
|
|
|
|
std::cerr << "Cell click callback raised an exception:" << std::endl;
|
|
|
|
|
PyErr_Print();
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
} else {
|
|
|
|
|
Py_DECREF(result);
|
|
|
|
|
}
|
2026-01-05 10:16:16 -05:00
|
|
|
}
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return this;
|
|
|
|
|
}
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
|
|
|
|
|
// #142 - Even without click_callable, fire on_cell_click if present
|
|
|
|
|
// Note: We fire the callback but DON'T return this, because PyScene::do_mouse_input
|
|
|
|
|
// would try to call click_callable which doesn't exist
|
|
|
|
|
if (on_cell_click_callable) {
|
|
|
|
|
int cell_x = static_cast<int>(std::floor(grid_x));
|
|
|
|
|
int cell_y = static_cast<int>(std::floor(grid_y));
|
|
|
|
|
|
|
|
|
|
// Only fire if within valid grid bounds
|
2026-01-06 10:21:50 -05:00
|
|
|
if (cell_x >= 0 && cell_x < this->grid_w && cell_y >= 0 && cell_y < this->grid_h) {
|
2026-01-05 10:31:41 -05:00
|
|
|
// Create Vector object for cell position - must fetch finalized type from module
|
|
|
|
|
PyObject* vector_type = PyObject_GetAttrString(McRFPy_API::mcrf_module, "Vector");
|
|
|
|
|
if (vector_type) {
|
|
|
|
|
PyObject* cell_pos = PyObject_CallFunction(vector_type, "ff", (float)cell_x, (float)cell_y);
|
|
|
|
|
Py_DECREF(vector_type);
|
|
|
|
|
if (cell_pos) {
|
|
|
|
|
PyObject* args = Py_BuildValue("(O)", cell_pos);
|
|
|
|
|
Py_DECREF(cell_pos);
|
|
|
|
|
PyObject* result = PyObject_CallObject(on_cell_click_callable->borrow(), args);
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
if (!result) {
|
|
|
|
|
std::cerr << "Cell click callback raised an exception:" << std::endl;
|
|
|
|
|
PyErr_Print();
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
} else {
|
|
|
|
|
Py_DECREF(result);
|
|
|
|
|
}
|
2026-01-05 10:16:16 -05:00
|
|
|
}
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
}
|
|
|
|
|
// Don't return this - no click_callable to call
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return nullptr;
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int UIGrid::init(PyUIGridObject* self, PyObject* args, PyObject* kwds) {
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
// Define all parameters with defaults
|
|
|
|
|
PyObject* pos_obj = nullptr;
|
|
|
|
|
PyObject* size_obj = nullptr;
|
|
|
|
|
PyObject* grid_size_obj = nullptr;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
PyObject* textureObj = nullptr;
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
PyObject* fill_color = nullptr;
|
|
|
|
|
PyObject* click_handler = nullptr;
|
2025-11-28 23:04:09 -05:00
|
|
|
PyObject* layers_obj = nullptr; // #150 - layers dict
|
feat: Grid camera defaults to tile (0,0) at top-left + center_camera() method (#169)
Changes:
- Default Grid center now positions tile (0,0) at widget's top-left corner
- Added center_camera() method to center grid's middle tile at view center
- Added center_camera((tile_x, tile_y)) to position tile at top-left of widget
- Uses NaN as sentinel to detect if user provided center values in kwargs
- Animation-compatible: center_camera() just sets center property, no special state
Behavior:
- center_camera() → grid's center tile at view center
- center_camera((0, 0)) → tile (0,0) at top-left corner
- center_camera((5, 10)) → tile (5,10) at top-left corner
Before: Grid(size=(320,240)) showed 3/4 of content off-screen (center=0,0)
After: Grid(size=(320,240)) shows tile (0,0) at top-left (center=160,120)
Closes #169
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:30:51 -05:00
|
|
|
// #169 - Use NaN as sentinel to detect if user provided center values
|
|
|
|
|
float center_x = std::numeric_limits<float>::quiet_NaN();
|
|
|
|
|
float center_y = std::numeric_limits<float>::quiet_NaN();
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
float zoom = 1.0f;
|
2025-07-21 23:47:21 -04:00
|
|
|
// perspective is now handled via properties, not init args
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
int visible = 1;
|
|
|
|
|
float opacity = 1.0f;
|
|
|
|
|
int z_index = 0;
|
|
|
|
|
const char* name = nullptr;
|
|
|
|
|
float x = 0.0f, y = 0.0f, w = 0.0f, h = 0.0f;
|
2026-01-06 10:21:50 -05:00
|
|
|
int grid_w = 2, grid_h = 2; // Default to 2x2 grid
|
2025-11-28 23:04:09 -05:00
|
|
|
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
// Keywords list matches the new spec: positional args first, then all keyword args
|
|
|
|
|
static const char* kwlist[] = {
|
|
|
|
|
"pos", "size", "grid_size", "texture", // Positional args (as per spec)
|
|
|
|
|
// Keyword-only args
|
refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to
`on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line,
Circle, Arc).
Before: Frame(pos=(0,0), size=(100,100), click=handler)
After: Frame(pos=(0,0), size=(100,100), on_click=handler)
The property name was already `on_click` - this makes the constructor
kwarg match, completing the callback naming standardization from #139.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 14:31:22 -05:00
|
|
|
"fill_color", "on_click", "center_x", "center_y", "zoom",
|
2026-01-06 10:21:50 -05:00
|
|
|
"visible", "opacity", "z_index", "name", "x", "y", "w", "h", "grid_w", "grid_h",
|
2025-11-28 23:04:09 -05:00
|
|
|
"layers", // #150 - layers dict parameter
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
nullptr
|
|
|
|
|
};
|
2025-11-28 23:04:09 -05:00
|
|
|
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
// Parse arguments with | for optional positional args
|
2025-11-28 23:04:09 -05:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOOOOfffifizffffiiO", const_cast<char**>(kwlist),
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
&pos_obj, &size_obj, &grid_size_obj, &textureObj, // Positional
|
2025-07-21 23:47:21 -04:00
|
|
|
&fill_color, &click_handler, ¢er_x, ¢er_y, &zoom,
|
2026-01-06 10:21:50 -05:00
|
|
|
&visible, &opacity, &z_index, &name, &x, &y, &w, &h, &grid_w, &grid_h,
|
2025-11-28 23:04:09 -05:00
|
|
|
&layers_obj)) {
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
return -1;
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
// Handle position argument (can be tuple, Vector, or use x/y keywords)
|
|
|
|
|
if (pos_obj) {
|
|
|
|
|
PyVectorObject* vec = PyVector::from_arg(pos_obj);
|
|
|
|
|
if (vec) {
|
|
|
|
|
x = vec->data.x;
|
|
|
|
|
y = vec->data.y;
|
|
|
|
|
Py_DECREF(vec);
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
} else {
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
PyErr_Clear();
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
if (PyTuple_Check(pos_obj) && PyTuple_Size(pos_obj) == 2) {
|
|
|
|
|
PyObject* x_val = PyTuple_GetItem(pos_obj, 0);
|
|
|
|
|
PyObject* y_val = PyTuple_GetItem(pos_obj, 1);
|
|
|
|
|
if ((PyFloat_Check(x_val) || PyLong_Check(x_val)) &&
|
|
|
|
|
(PyFloat_Check(y_val) || PyLong_Check(y_val))) {
|
|
|
|
|
x = PyFloat_Check(x_val) ? PyFloat_AsDouble(x_val) : PyLong_AsLong(x_val);
|
|
|
|
|
y = PyFloat_Check(y_val) ? PyFloat_AsDouble(y_val) : PyLong_AsLong(y_val);
|
|
|
|
|
} else {
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError, "pos tuple must contain numbers");
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError, "pos must be a tuple (x, y) or Vector");
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle size argument (can be tuple or use w/h keywords)
|
|
|
|
|
if (size_obj) {
|
|
|
|
|
if (PyTuple_Check(size_obj) && PyTuple_Size(size_obj) == 2) {
|
|
|
|
|
PyObject* w_val = PyTuple_GetItem(size_obj, 0);
|
|
|
|
|
PyObject* h_val = PyTuple_GetItem(size_obj, 1);
|
|
|
|
|
if ((PyFloat_Check(w_val) || PyLong_Check(w_val)) &&
|
|
|
|
|
(PyFloat_Check(h_val) || PyLong_Check(h_val))) {
|
|
|
|
|
w = PyFloat_Check(w_val) ? PyFloat_AsDouble(w_val) : PyLong_AsLong(w_val);
|
|
|
|
|
h = PyFloat_Check(h_val) ? PyFloat_AsDouble(h_val) : PyLong_AsLong(h_val);
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
} else {
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError, "size tuple must contain numbers");
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError, "size must be a tuple (w, h)");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-06 10:21:50 -05:00
|
|
|
// Handle grid_size argument (can be tuple or use grid_w/grid_h keywords)
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
if (grid_size_obj) {
|
|
|
|
|
if (PyTuple_Check(grid_size_obj) && PyTuple_Size(grid_size_obj) == 2) {
|
|
|
|
|
PyObject* gx_val = PyTuple_GetItem(grid_size_obj, 0);
|
|
|
|
|
PyObject* gy_val = PyTuple_GetItem(grid_size_obj, 1);
|
|
|
|
|
if (PyLong_Check(gx_val) && PyLong_Check(gy_val)) {
|
2026-01-06 10:21:50 -05:00
|
|
|
grid_w = PyLong_AsLong(gx_val);
|
|
|
|
|
grid_h = PyLong_AsLong(gy_val);
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
} else {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "grid_size tuple must contain integers");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2026-01-06 10:21:50 -05:00
|
|
|
PyErr_SetString(PyExc_TypeError, "grid_size must be a tuple (grid_w, grid_h)");
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
return -1;
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
}
|
2025-03-05 20:21:24 -05:00
|
|
|
}
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Validate grid dimensions
|
2026-01-06 10:21:50 -05:00
|
|
|
if (grid_w <= 0 || grid_h <= 0) {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
PyErr_SetString(PyExc_ValueError, "Grid dimensions must be positive integers");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
// Handle texture argument
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
std::shared_ptr<PyTexture> texture_ptr = nullptr;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
if (textureObj && textureObj != Py_None) {
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
if (!PyObject_IsInstance(textureObj, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Texture"))) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "texture must be a mcrfpy.Texture instance or None");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
PyTextureObject* pyTexture = reinterpret_cast<PyTextureObject*>(textureObj);
|
|
|
|
|
texture_ptr = pyTexture->data;
|
|
|
|
|
} else {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Use default texture when None is provided or texture not specified
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
texture_ptr = McRFPy_API::default_texture;
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
// If size wasn't specified, calculate based on grid dimensions and texture
|
|
|
|
|
if (!size_obj && texture_ptr) {
|
2026-01-06 10:21:50 -05:00
|
|
|
w = grid_w * texture_ptr->sprite_width;
|
|
|
|
|
h = grid_h * texture_ptr->sprite_height;
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
} else if (!size_obj) {
|
2026-01-06 10:21:50 -05:00
|
|
|
w = grid_w * 16.0f; // Default tile size
|
|
|
|
|
h = grid_h * 16.0f;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
}
|
2026-01-06 10:21:50 -05:00
|
|
|
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
// Create the grid
|
2026-01-06 10:21:50 -05:00
|
|
|
self->data = std::make_shared<UIGrid>(grid_w, grid_h, texture_ptr,
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
sf::Vector2f(x, y), sf::Vector2f(w, h));
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
|
|
|
|
|
// Set additional properties
|
feat: Grid camera defaults to tile (0,0) at top-left + center_camera() method (#169)
Changes:
- Default Grid center now positions tile (0,0) at widget's top-left corner
- Added center_camera() method to center grid's middle tile at view center
- Added center_camera((tile_x, tile_y)) to position tile at top-left of widget
- Uses NaN as sentinel to detect if user provided center values in kwargs
- Animation-compatible: center_camera() just sets center property, no special state
Behavior:
- center_camera() → grid's center tile at view center
- center_camera((0, 0)) → tile (0,0) at top-left corner
- center_camera((5, 10)) → tile (5,10) at top-left corner
Before: Grid(size=(320,240)) showed 3/4 of content off-screen (center=0,0)
After: Grid(size=(320,240)) shows tile (0,0) at top-left (center=160,120)
Closes #169
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:30:51 -05:00
|
|
|
self->data->zoom = zoom; // Set zoom first, needed for default center calculation
|
|
|
|
|
|
|
|
|
|
// #169 - Calculate default center if not provided by user
|
|
|
|
|
// Default: tile (0,0) at top-left of widget
|
|
|
|
|
if (std::isnan(center_x)) {
|
|
|
|
|
// Center = half widget size (in pixels), so tile 0,0 appears at top-left
|
|
|
|
|
center_x = w / (2.0f * zoom);
|
|
|
|
|
}
|
|
|
|
|
if (std::isnan(center_y)) {
|
|
|
|
|
center_y = h / (2.0f * zoom);
|
|
|
|
|
}
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
self->data->center_x = center_x;
|
|
|
|
|
self->data->center_y = center_y;
|
2025-07-21 23:47:21 -04:00
|
|
|
// perspective is now handled by perspective_entity and perspective_enabled
|
|
|
|
|
// self->data->perspective = perspective;
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
self->data->visible = visible;
|
|
|
|
|
self->data->opacity = opacity;
|
|
|
|
|
self->data->z_index = z_index;
|
|
|
|
|
if (name) {
|
|
|
|
|
self->data->name = std::string(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle fill_color
|
|
|
|
|
if (fill_color && fill_color != Py_None) {
|
|
|
|
|
PyColorObject* color_obj = PyColor::from_arg(fill_color);
|
|
|
|
|
if (!color_obj) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "fill_color must be a Color or color tuple");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
self->data->box.setFillColor(color_obj->data);
|
|
|
|
|
Py_DECREF(color_obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Handle click handler
|
|
|
|
|
if (click_handler && click_handler != Py_None) {
|
|
|
|
|
if (!PyCallable_Check(click_handler)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "click must be callable");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
self->data->click_register(click_handler);
|
|
|
|
|
}
|
2025-11-28 23:04:09 -05:00
|
|
|
|
|
|
|
|
// #150 - Handle layers dict
|
|
|
|
|
// Default: {"tilesprite": "tile"} when layers not provided
|
|
|
|
|
// Empty dict: no rendering layers (entity storage + pathfinding only)
|
|
|
|
|
if (layers_obj == nullptr) {
|
2025-11-28 23:21:39 -05:00
|
|
|
// Default layer: single TileLayer named "tilesprite" (z_index -1 = below entities)
|
|
|
|
|
self->data->addTileLayer(-1, texture_ptr, "tilesprite");
|
2025-11-28 23:04:09 -05:00
|
|
|
} else if (layers_obj != Py_None) {
|
|
|
|
|
if (!PyDict_Check(layers_obj)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "layers must be a dict mapping names to types ('color' or 'tile')");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* key;
|
|
|
|
|
PyObject* value;
|
|
|
|
|
Py_ssize_t pos = 0;
|
2025-11-28 23:21:39 -05:00
|
|
|
int layer_z = -1; // Start at -1 (below entities), decrement for each layer
|
2025-11-28 23:04:09 -05:00
|
|
|
|
|
|
|
|
while (PyDict_Next(layers_obj, &pos, &key, &value)) {
|
|
|
|
|
if (!PyUnicode_Check(key)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "Layer names must be strings");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (!PyUnicode_Check(value)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "Layer types must be strings ('color' or 'tile')");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char* layer_name = PyUnicode_AsUTF8(key);
|
|
|
|
|
const char* layer_type = PyUnicode_AsUTF8(value);
|
|
|
|
|
|
|
|
|
|
// Check for protected names
|
|
|
|
|
if (UIGrid::isProtectedLayerName(layer_name)) {
|
|
|
|
|
PyErr_Format(PyExc_ValueError, "Layer name '%s' is reserved", layer_name);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strcmp(layer_type, "color") == 0) {
|
2025-11-28 23:21:39 -05:00
|
|
|
self->data->addColorLayer(layer_z--, layer_name);
|
2025-11-28 23:04:09 -05:00
|
|
|
} else if (strcmp(layer_type, "tile") == 0) {
|
2025-11-28 23:21:39 -05:00
|
|
|
self->data->addTileLayer(layer_z--, texture_ptr, layer_name);
|
2025-11-28 23:04:09 -05:00
|
|
|
} else {
|
|
|
|
|
PyErr_Format(PyExc_ValueError, "Unknown layer type '%s' (expected 'color' or 'tile')", layer_type);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// else: layers_obj is Py_None - explicit empty, no layers created
|
|
|
|
|
|
Squashed commit of the following: [alpha_presentable]
Author: John McCardle <mccardle.john@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
commit dc47f2474c7b2642d368f9772894aed857527807
the UIEntity rant
commit 673ca8e1b089ea670257fc04ae1a676ed95a40ed
I forget when these tests were written, but I want them in the squash merge
commit 70c71565c684fa96e222179271ecb13a156d80ad
Fix UI object segfault by switching from managed to manual weakref management
The UI types (Frame, Caption, Sprite, Grid, Entity) were using
Py_TPFLAGS_MANAGED_WEAKREF while also trying to manually create weakrefs
for the PythonObjectCache. This is fundamentally incompatible - when
Python manages weakrefs internally, PyWeakref_NewRef() cannot access the
weakref list properly, causing segfaults.
Changed all UI types to use manual weakref management (like PyTimer):
- Restored weakreflist field in all UI type structures
- Removed Py_TPFLAGS_MANAGED_WEAKREF from all UI type flags
- Added tp_weaklistoffset for all UI types in module initialization
- Initialize weakreflist=NULL in tp_new and init methods
- Call PyObject_ClearWeakRefs() in dealloc functions
This allows the PythonObjectCache to continue working correctly,
maintaining Python object identity for C++ objects across the boundary.
Fixes segfault when creating UI objects (e.g., Caption, Grid) that was
preventing tutorial scripts from running.
This is the bulk of the required behavior for Issue #126.
that issure isn't ready for closure yet; several other sub-issues left.
closes #110
mention issue #109 - resolves some __init__ related nuisances
commit 3dce3ec539ae99e32d869007bf3f49d03e4e2f89
Refactor timer system for cleaner architecture and enhanced functionality
Major improvements to the timer system:
- Unified all timer logic in the Timer class (C++)
- Removed PyTimerCallable subclass, now using PyCallable directly
- Timer objects are now passed to callbacks as first argument
- Added 'once' parameter for one-shot timers that auto-stop
- Implemented proper PythonObjectCache integration with weakref support
API enhancements:
- New callback signature: callback(timer, runtime) instead of just (runtime)
- Timer objects expose: name, interval, remaining, paused, active, once properties
- Methods: pause(), resume(), cancel(), restart()
- Comprehensive documentation with examples
- Enhanced repr showing timer state (active/paused/once/remaining time)
This cleanup follows the UIEntity/PyUIEntity pattern and makes the timer
system more Pythonic while maintaining backward compatibility through
the legacy setTimer/delTimer API.
closes #121
commit 145834cfc31b8dabc4cb3591b9cb4ed99fc8b964
Implement Python object cache to preserve derived types in collections
Add a global cache system that maintains weak references to Python objects,
ensuring that derived Python classes maintain their identity when stored in
and retrieved from C++ collections.
Key changes:
- Add PythonObjectCache singleton with serial number system
- Each cacheable object (UIDrawable, UIEntity, Timer, Animation) gets unique ID
- Cache stores weak references to prevent circular reference memory leaks
- Update all UI type definitions to support weak references (Py_TPFLAGS_MANAGED_WEAKREF)
- Enable subclassing for all UI types (Py_TPFLAGS_BASETYPE)
- Collections check cache before creating new Python wrappers
- Register objects in cache during __init__ methods
- Clean up cache entries in C++ destructors
This ensures that Python code like:
```python
class MyFrame(mcrfpy.Frame):
def __init__(self):
super().__init__()
self.custom_data = "preserved"
frame = MyFrame()
scene.ui.append(frame)
retrieved = scene.ui[0] # Same MyFrame instance with custom_data intact
```
Works correctly, with retrieved maintaining the derived type and custom attributes.
Closes #112
commit c5e7e8e29835a69f4c50f3c99fd3123012635a9a
Update test demos for new Python API and entity system
- Update all text input demos to use new Entity constructor signature
- Fix pathfinding showcase to work with new entity position handling
- Remove entity_waypoints tracking in favor of simplified movement
- Delete obsolete exhaustive_api_demo.py (superseded by newer demos)
- Adjust entity creation calls to match Entity((x, y), texture, sprite_index) pattern
commit 6d29652ae7418745dc24066532454167d447df89
Update animation demo suite with crash fixes and improvements
- Add warnings about AnimationManager segfault bug in sizzle_reel_final.py
- Create sizzle_reel_final_fixed.py that works around the crash by hiding objects instead of removing them
- Increase font sizes for better visibility in demos
- Extend demo durations for better showcase of animations
- Remove debug prints from animation_sizzle_reel_working.py
- Minor cleanup and improvements to all animation demos
commit a010e5fa968feaba620dcf2eda44fb9514512151
Update game scripts for new Python API
- Convert entity position access from tuple to x/y properties
- Update caption size property to font_size
- Fix grid boundary checks to use grid_size instead of exceptions
- Clean up demo timer on menu exit to prevent callbacks
These changes adapt the game scripts to work with the new standardized
Python API constructors and property names.
commit 9c8d6c459109be883cb8070b8ef83c60bfc1a970
Fix click event z-order handling in PyScene
Changed click detection to properly respect z-index by:
- Sorting ui_elements in-place when needed (same as render order)
- Using reverse iterators to check highest z-index elements first
- This ensures top-most elements receive clicks before lower ones
commit dcd1b0ca33d46639023221f4d7d52000b947dbdf
Add roguelike tutorial implementation files
Implement Parts 0-2 of the classic roguelike tutorial adapted for McRogueFace:
- Part 0: Basic grid setup and tile rendering
- Part 1: Drawing '@' symbol and basic movement
- Part 1b: Variant with sprite-based player
- Part 2: Entity system and NPC implementation with three movement variants:
- part_2.py: Standard implementation
- part_2-naive.py: Naive movement approach
- part_2-onemovequeued.py: Queued movement system
Includes tutorial assets:
- tutorial2.png: Tileset for dungeon tiles
- tutorial_hero.png: Player sprite sheet
commit 6813fb5129738cca2d79c80304834523561ba7fb
Standardize Python API constructors and remove PyArgHelpers
- Remove PyArgHelpers.h and all macro-based argument parsing
- Convert all UI class constructors to use PyArg_ParseTupleAndKeywords
- Standardize constructor signatures across UICaption, UIEntity, UIFrame, UIGrid, and UISprite
- Replace PYARGHELPER_SINGLE/MULTI macros with explicit argument parsing
- Improve error messages and argument validation
- Maintain backward compatibility with existing Python code
This change improves code maintainability and consistency across the Python API.
commit 6f67fbb51efaf70e52fba8c939298dcdff50450a
Fix animation callback crashes from iterator invalidation (#119)
Resolved segfaults caused by creating new animations from within
animation callbacks. The issue was iterator invalidation in
AnimationManager::update() when callbacks modified the active
animations vector.
Changes:
- Add deferred animation queue to AnimationManager
- New animations created during update are queued and added after
- Set isUpdating flag to track when in update loop
- Properly handle Animation destructor during callback execution
- Add clearCallback() method for safe cleanup scenarios
This fixes the "free(): invalid pointer" and "malloc(): unaligned
fastbin chunk detected" errors that occurred with rapid animation
creation in callbacks.
commit eb88c7b3aab3da519db7569106c34f3510b6e963
Add animation completion callbacks (#119)
Implement callbacks that fire when animations complete, enabling direct
causality between animation end and game state changes. This eliminates
race conditions from parallel timer workarounds.
- Add optional callback parameter to Animation constructor
- Callbacks execute synchronously when animation completes
- Proper Python reference counting with GIL safety
- Callbacks receive (anim, target) parameters (currently None)
- Exception handling prevents crashes from Python errors
Example usage:
```python
def on_complete(anim, target):
player_moving = False
anim = mcrfpy.Animation("x", 300.0, 1.0, "easeOut", callback=on_complete)
anim.start(player)
```
closes #119
commit 9fb428dd0176a4d7cfad09deb7509d8aa5562868
Update ROADMAP with GitHub issue numbers (#111-#125)
Added issue numbers from GitHub tracker to roadmap items:
- #111: Grid Click Events Broken in Headless
- #112: Object Splitting Bug (Python type preservation)
- #113: Batch Operations for Grid
- #114: CellView API
- #115: SpatialHash Implementation
- #116: Dirty Flag System
- #117: Memory Pool for Entities
- #118: Scene as Drawable
- #119: Animation Completion Callbacks
- #120: Animation Property Locking
- #121: Timer Object System
- #122: Parent-Child UI System
- #123: Grid Subgrid System
- #124: Grid Point Animation
- #125: GitHub Issues Automation
Also updated existing references:
- #101/#110: Constructor standardization
- #109: Vector class indexing
Note: Tutorial-specific items and Python-implementable features
(input queue, collision reservation) are not tracked as engine issues.
commit 062e4dadc42833bf5a3559e5d7c4ceb4abb7e9c0
Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects
Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers
This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.
commit 98fc49a978ec792ee6096f40fd4e19841b8ec6a3
Directory structure cleanup and organization overhaul
2025-07-15 21:30:49 -04:00
|
|
|
// Initialize weak reference list
|
|
|
|
|
self->weakreflist = NULL;
|
|
|
|
|
|
|
|
|
|
// Register in Python object cache
|
|
|
|
|
if (self->data->serial_number == 0) {
|
|
|
|
|
self->data->serial_number = PythonObjectCache::getInstance().assignSerial();
|
|
|
|
|
PyObject* weakref = PyWeakref_NewRef((PyObject*)self, NULL);
|
|
|
|
|
if (weakref) {
|
|
|
|
|
PythonObjectCache::getInstance().registerObject(self->data->serial_number, weakref);
|
|
|
|
|
Py_DECREF(weakref); // Cache owns the reference now
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-01-09 21:37:23 -05:00
|
|
|
|
|
|
|
|
// #184: Check if this is a Python subclass (for callback method support)
|
|
|
|
|
PyObject* grid_type = PyObject_GetAttrString(McRFPy_API::mcrf_module, "Grid");
|
|
|
|
|
if (grid_type) {
|
|
|
|
|
self->data->is_python_subclass = (PyObject*)Py_TYPE(self) != grid_type;
|
|
|
|
|
Py_DECREF(grid_type);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
return 0; // Success
|
|
|
|
|
}
|
|
|
|
|
|
Python API improvements: Vectors, bounds, window singleton, hidden types
- #177: GridPoint.grid_pos property returns (x, y) tuple
- #179: Grid.grid_size returns Vector instead of tuple
- #181: Grid.center returns Vector instead of tuple
- #182: Caption.size/w/h read-only properties for text dimensions
- #184: mcrfpy.window singleton for window access
- #185: Removed get_bounds() method, use .bounds property instead
- #188: bounds/global_bounds return (pos, size) as pair of Vectors
- #189: Hide internal types from module namespace (iterators, collections)
Also fixed critical bug: Changed static PyTypeObject to inline in headers
to ensure single instance across translation units (was causing segfaults).
Closes #177, closes #179, closes #181, closes #182, closes #184, closes #185, closes #188, closes #189
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 23:00:48 -05:00
|
|
|
// #179 - Return grid_size as Vector
|
2024-04-20 10:32:04 -04:00
|
|
|
PyObject* UIGrid::get_grid_size(PyUIGridObject* self, void* closure) {
|
2026-01-06 10:21:50 -05:00
|
|
|
return PyVector(sf::Vector2f(static_cast<float>(self->data->grid_w),
|
|
|
|
|
static_cast<float>(self->data->grid_h))).pyObject();
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
|
2026-01-06 10:21:50 -05:00
|
|
|
PyObject* UIGrid::get_grid_w(PyUIGridObject* self, void* closure) {
|
|
|
|
|
return PyLong_FromLong(self->data->grid_w);
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
}
|
|
|
|
|
|
2026-01-06 10:21:50 -05:00
|
|
|
PyObject* UIGrid::get_grid_h(PyUIGridObject* self, void* closure) {
|
|
|
|
|
return PyLong_FromLong(self->data->grid_h);
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
}
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
PyObject* UIGrid::get_position(PyUIGridObject* self, void* closure) {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return Py_BuildValue("(ff)", self->data->position.x, self->data->position.y);
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_position(PyUIGridObject* self, PyObject* value, void* closure) {
|
|
|
|
|
float x, y;
|
|
|
|
|
if (!PyArg_ParseTuple(value, "ff", &x, &y)) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError, "Position must be a tuple of two floats");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
self->data->position = sf::Vector2f(x, y); // Update base class position
|
|
|
|
|
self->data->box.setPosition(self->data->position); // Sync box position
|
|
|
|
|
self->data->output.setPosition(self->data->position); // Sync output sprite position
|
2024-04-20 10:32:04 -04:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-06 10:21:50 -05:00
|
|
|
// #181 - Return size as Vector
|
2024-04-20 10:32:04 -04:00
|
|
|
PyObject* UIGrid::get_size(PyUIGridObject* self, void* closure) {
|
|
|
|
|
auto& box = self->data->box;
|
2026-01-06 10:21:50 -05:00
|
|
|
return PyVector(box.getSize()).pyObject();
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_size(PyUIGridObject* self, PyObject* value, void* closure) {
|
|
|
|
|
float w, h;
|
2026-01-06 10:21:50 -05:00
|
|
|
// Accept Vector or tuple
|
|
|
|
|
PyVectorObject* vec = PyVector::from_arg(value);
|
|
|
|
|
if (vec) {
|
|
|
|
|
w = vec->data.x;
|
|
|
|
|
h = vec->data.y;
|
|
|
|
|
Py_DECREF(vec);
|
|
|
|
|
} else {
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
if (!PyArg_ParseTuple(value, "ff", &w, &h)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "size must be a Vector or tuple (w, h)");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
self->data->box.setSize(sf::Vector2f(w, h));
|
Squashed commit of the following: [alpha_streamline_1]
the low-hanging fruit of pre-existing issues and standardizing the
Python interfaces
Special thanks to Claude Code, ~100k output tokens for this merge
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 99f301e3a0e9e81ad28c9e1d410390c32dfd933c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:25:32 2025 -0400
Add position tuple support and pos property to UI elements
closes #83, closes #84
- Issue #83: Add position tuple support to constructors
- Frame and Sprite now accept both (x, y) and ((x, y)) forms
- Also accept Vector objects as position arguments
- Caption and Entity already supported tuple/Vector forms
- Uses PyVector::from_arg for flexible position parsing
- Issue #84: Add pos property to Frame and Sprite
- Added pos getter that returns a Vector
- Added pos setter that accepts Vector or tuple
- Provides consistency with Caption and Entity which already had pos properties
- All UI elements now have a uniform way to get/set positions as Vectors
Both features improve API consistency and make it easier to work with positions.
commit 2f2b488fb54da12c39c0010dbd83cb9f6c429b01
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:18:10 2025 -0400
Standardize sprite_index property and add scale_x/scale_y to UISprite
closes #81, closes #82
- Issue #81: Standardized property name to sprite_index across UISprite and UIEntity
- Added sprite_index as the primary property name
- Kept sprite_number as a deprecated alias for backward compatibility
- Updated repr() methods to use sprite_index
- Updated animation system to recognize both names
- Issue #82: Added scale_x and scale_y properties to UISprite
- Enables non-uniform scaling of sprites
- scale property still works for uniform scaling
- Both properties work with the animation system
All existing code using sprite_number continues to work due to backward compatibility.
commit 5a003a9aa587eb8ee4b79ac67ca8f342ab62e2d2
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:09:52 2025 -0400
Fix multiple low priority issues
closes #12, closes #80, closes #95, closes #96, closes #99
- Issue #12: Set tp_new to NULL for GridPoint and GridPointState to prevent instantiation from Python
- Issue #80: Renamed Caption.size to Caption.font_size for semantic clarity
- Issue #95: Fixed UICollection repr to show actual derived types instead of generic UIDrawable
- Issue #96: Added extend() method to UICollection for API consistency with UIEntityCollection
- Issue #99: Exposed read-only properties for Texture (sprite_width, sprite_height, sheet_width, sheet_height, sprite_count, source) and Font (family, source)
All issues have corresponding tests that verify the fixes work correctly.
commit e5affaf317665395135c936bc4a6b840ae321765
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 15:50:09 2025 -0400
Fix critical issues: script loading, entity types, and color properties
- Issue #37: Fix Windows scripts subdirectory not checked
- Updated executeScript() to use executable_path() from platform.h
- Scripts now load correctly when working directory differs from executable
- Issue #76: Fix UIEntityCollection returns wrong type
- Updated UIEntityCollectionIter::next() to check for stored Python object
- Derived Entity classes now preserve their type when retrieved from collections
- Issue #9: Recreate RenderTexture when resized (already fixed)
- Confirmed RenderTexture recreation already implemented in set_size() and set_float_member()
- Uses 1.5x padding and 4096 max size limit
- Issue #79: Fix Color r, g, b, a properties return None
- Implemented get_member() and set_member() in PyColor.cpp
- Color component properties now work correctly with proper validation
- Additional fix: Grid.at() method signature
- Changed from METH_O to METH_VARARGS to accept two arguments
All fixes include comprehensive tests to verify functionality.
closes #37, closes #76, closes #9, closes #79
2025-07-05 17:30:49 -04:00
|
|
|
|
|
|
|
|
// Recreate renderTexture with new size to avoid rendering issues
|
|
|
|
|
// Add some padding to handle zoom and ensure we don't cut off content
|
|
|
|
|
unsigned int tex_width = static_cast<unsigned int>(w * 1.5f);
|
|
|
|
|
unsigned int tex_height = static_cast<unsigned int>(h * 1.5f);
|
|
|
|
|
|
|
|
|
|
// Clamp to reasonable maximum to avoid GPU memory issues
|
|
|
|
|
tex_width = std::min(tex_width, 4096u);
|
|
|
|
|
tex_height = std::min(tex_height, 4096u);
|
|
|
|
|
|
|
|
|
|
self->data->renderTexture.create(tex_width, tex_height);
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
Python API improvements: Vectors, bounds, window singleton, hidden types
- #177: GridPoint.grid_pos property returns (x, y) tuple
- #179: Grid.grid_size returns Vector instead of tuple
- #181: Grid.center returns Vector instead of tuple
- #182: Caption.size/w/h read-only properties for text dimensions
- #184: mcrfpy.window singleton for window access
- #185: Removed get_bounds() method, use .bounds property instead
- #188: bounds/global_bounds return (pos, size) as pair of Vectors
- #189: Hide internal types from module namespace (iterators, collections)
Also fixed critical bug: Changed static PyTypeObject to inline in headers
to ensure single instance across translation units (was causing segfaults).
Closes #177, closes #179, closes #181, closes #182, closes #184, closes #185, closes #188, closes #189
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 23:00:48 -05:00
|
|
|
// #181 - Return center as Vector
|
2024-04-20 10:32:04 -04:00
|
|
|
PyObject* UIGrid::get_center(PyUIGridObject* self, void* closure) {
|
Python API improvements: Vectors, bounds, window singleton, hidden types
- #177: GridPoint.grid_pos property returns (x, y) tuple
- #179: Grid.grid_size returns Vector instead of tuple
- #181: Grid.center returns Vector instead of tuple
- #182: Caption.size/w/h read-only properties for text dimensions
- #184: mcrfpy.window singleton for window access
- #185: Removed get_bounds() method, use .bounds property instead
- #188: bounds/global_bounds return (pos, size) as pair of Vectors
- #189: Hide internal types from module namespace (iterators, collections)
Also fixed critical bug: Changed static PyTypeObject to inline in headers
to ensure single instance across translation units (was causing segfaults).
Closes #177, closes #179, closes #181, closes #182, closes #184, closes #185, closes #188, closes #189
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 23:00:48 -05:00
|
|
|
return PyVector(sf::Vector2f(self->data->center_x, self->data->center_y)).pyObject();
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_center(PyUIGridObject* self, PyObject* value, void* closure) {
|
|
|
|
|
float x, y;
|
|
|
|
|
if (!PyArg_ParseTuple(value, "ff", &x, &y)) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError, "Size must be a tuple of two floats");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
self->data->center_x = x;
|
|
|
|
|
self->data->center_y = y;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::get_float_member(PyUIGridObject* self, void* closure)
|
|
|
|
|
{
|
2026-01-08 10:41:24 -05:00
|
|
|
auto member_ptr = reinterpret_cast<intptr_t>(closure);
|
2024-04-20 10:32:04 -04:00
|
|
|
if (member_ptr == 0) // x
|
|
|
|
|
return PyFloat_FromDouble(self->data->box.getPosition().x);
|
|
|
|
|
else if (member_ptr == 1) // y
|
|
|
|
|
return PyFloat_FromDouble(self->data->box.getPosition().y);
|
|
|
|
|
else if (member_ptr == 2) // w
|
|
|
|
|
return PyFloat_FromDouble(self->data->box.getSize().x);
|
|
|
|
|
else if (member_ptr == 3) // h
|
|
|
|
|
return PyFloat_FromDouble(self->data->box.getSize().y);
|
|
|
|
|
else if (member_ptr == 4) // center_x
|
|
|
|
|
return PyFloat_FromDouble(self->data->center_x);
|
|
|
|
|
else if (member_ptr == 5) // center_y
|
|
|
|
|
return PyFloat_FromDouble(self->data->center_y);
|
|
|
|
|
else if (member_ptr == 6) // zoom
|
|
|
|
|
return PyFloat_FromDouble(self->data->zoom);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PyErr_SetString(PyExc_AttributeError, "Invalid attribute");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_float_member(PyUIGridObject* self, PyObject* value, void* closure)
|
|
|
|
|
{
|
|
|
|
|
float val;
|
2026-01-08 10:41:24 -05:00
|
|
|
auto member_ptr = reinterpret_cast<intptr_t>(closure);
|
2024-04-20 10:32:04 -04:00
|
|
|
if (PyFloat_Check(value))
|
|
|
|
|
{
|
|
|
|
|
val = PyFloat_AsDouble(value);
|
|
|
|
|
}
|
|
|
|
|
else if (PyLong_Check(value))
|
|
|
|
|
{
|
|
|
|
|
val = PyLong_AsLong(value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
PyErr_SetString(PyExc_TypeError, "Value must be a number (int or float)");
|
2024-04-20 10:32:04 -04:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (member_ptr == 0) // x
|
|
|
|
|
self->data->box.setPosition(val, self->data->box.getPosition().y);
|
|
|
|
|
else if (member_ptr == 1) // y
|
|
|
|
|
self->data->box.setPosition(self->data->box.getPosition().x, val);
|
|
|
|
|
else if (member_ptr == 2) // w
|
Squashed commit of the following: [alpha_streamline_1]
the low-hanging fruit of pre-existing issues and standardizing the
Python interfaces
Special thanks to Claude Code, ~100k output tokens for this merge
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 99f301e3a0e9e81ad28c9e1d410390c32dfd933c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:25:32 2025 -0400
Add position tuple support and pos property to UI elements
closes #83, closes #84
- Issue #83: Add position tuple support to constructors
- Frame and Sprite now accept both (x, y) and ((x, y)) forms
- Also accept Vector objects as position arguments
- Caption and Entity already supported tuple/Vector forms
- Uses PyVector::from_arg for flexible position parsing
- Issue #84: Add pos property to Frame and Sprite
- Added pos getter that returns a Vector
- Added pos setter that accepts Vector or tuple
- Provides consistency with Caption and Entity which already had pos properties
- All UI elements now have a uniform way to get/set positions as Vectors
Both features improve API consistency and make it easier to work with positions.
commit 2f2b488fb54da12c39c0010dbd83cb9f6c429b01
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:18:10 2025 -0400
Standardize sprite_index property and add scale_x/scale_y to UISprite
closes #81, closes #82
- Issue #81: Standardized property name to sprite_index across UISprite and UIEntity
- Added sprite_index as the primary property name
- Kept sprite_number as a deprecated alias for backward compatibility
- Updated repr() methods to use sprite_index
- Updated animation system to recognize both names
- Issue #82: Added scale_x and scale_y properties to UISprite
- Enables non-uniform scaling of sprites
- scale property still works for uniform scaling
- Both properties work with the animation system
All existing code using sprite_number continues to work due to backward compatibility.
commit 5a003a9aa587eb8ee4b79ac67ca8f342ab62e2d2
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:09:52 2025 -0400
Fix multiple low priority issues
closes #12, closes #80, closes #95, closes #96, closes #99
- Issue #12: Set tp_new to NULL for GridPoint and GridPointState to prevent instantiation from Python
- Issue #80: Renamed Caption.size to Caption.font_size for semantic clarity
- Issue #95: Fixed UICollection repr to show actual derived types instead of generic UIDrawable
- Issue #96: Added extend() method to UICollection for API consistency with UIEntityCollection
- Issue #99: Exposed read-only properties for Texture (sprite_width, sprite_height, sheet_width, sheet_height, sprite_count, source) and Font (family, source)
All issues have corresponding tests that verify the fixes work correctly.
commit e5affaf317665395135c936bc4a6b840ae321765
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 15:50:09 2025 -0400
Fix critical issues: script loading, entity types, and color properties
- Issue #37: Fix Windows scripts subdirectory not checked
- Updated executeScript() to use executable_path() from platform.h
- Scripts now load correctly when working directory differs from executable
- Issue #76: Fix UIEntityCollection returns wrong type
- Updated UIEntityCollectionIter::next() to check for stored Python object
- Derived Entity classes now preserve their type when retrieved from collections
- Issue #9: Recreate RenderTexture when resized (already fixed)
- Confirmed RenderTexture recreation already implemented in set_size() and set_float_member()
- Uses 1.5x padding and 4096 max size limit
- Issue #79: Fix Color r, g, b, a properties return None
- Implemented get_member() and set_member() in PyColor.cpp
- Color component properties now work correctly with proper validation
- Additional fix: Grid.at() method signature
- Changed from METH_O to METH_VARARGS to accept two arguments
All fixes include comprehensive tests to verify functionality.
closes #37, closes #76, closes #9, closes #79
2025-07-05 17:30:49 -04:00
|
|
|
{
|
2024-04-20 10:32:04 -04:00
|
|
|
self->data->box.setSize(sf::Vector2f(val, self->data->box.getSize().y));
|
Squashed commit of the following: [alpha_streamline_1]
the low-hanging fruit of pre-existing issues and standardizing the
Python interfaces
Special thanks to Claude Code, ~100k output tokens for this merge
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 99f301e3a0e9e81ad28c9e1d410390c32dfd933c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:25:32 2025 -0400
Add position tuple support and pos property to UI elements
closes #83, closes #84
- Issue #83: Add position tuple support to constructors
- Frame and Sprite now accept both (x, y) and ((x, y)) forms
- Also accept Vector objects as position arguments
- Caption and Entity already supported tuple/Vector forms
- Uses PyVector::from_arg for flexible position parsing
- Issue #84: Add pos property to Frame and Sprite
- Added pos getter that returns a Vector
- Added pos setter that accepts Vector or tuple
- Provides consistency with Caption and Entity which already had pos properties
- All UI elements now have a uniform way to get/set positions as Vectors
Both features improve API consistency and make it easier to work with positions.
commit 2f2b488fb54da12c39c0010dbd83cb9f6c429b01
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:18:10 2025 -0400
Standardize sprite_index property and add scale_x/scale_y to UISprite
closes #81, closes #82
- Issue #81: Standardized property name to sprite_index across UISprite and UIEntity
- Added sprite_index as the primary property name
- Kept sprite_number as a deprecated alias for backward compatibility
- Updated repr() methods to use sprite_index
- Updated animation system to recognize both names
- Issue #82: Added scale_x and scale_y properties to UISprite
- Enables non-uniform scaling of sprites
- scale property still works for uniform scaling
- Both properties work with the animation system
All existing code using sprite_number continues to work due to backward compatibility.
commit 5a003a9aa587eb8ee4b79ac67ca8f342ab62e2d2
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:09:52 2025 -0400
Fix multiple low priority issues
closes #12, closes #80, closes #95, closes #96, closes #99
- Issue #12: Set tp_new to NULL for GridPoint and GridPointState to prevent instantiation from Python
- Issue #80: Renamed Caption.size to Caption.font_size for semantic clarity
- Issue #95: Fixed UICollection repr to show actual derived types instead of generic UIDrawable
- Issue #96: Added extend() method to UICollection for API consistency with UIEntityCollection
- Issue #99: Exposed read-only properties for Texture (sprite_width, sprite_height, sheet_width, sheet_height, sprite_count, source) and Font (family, source)
All issues have corresponding tests that verify the fixes work correctly.
commit e5affaf317665395135c936bc4a6b840ae321765
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 15:50:09 2025 -0400
Fix critical issues: script loading, entity types, and color properties
- Issue #37: Fix Windows scripts subdirectory not checked
- Updated executeScript() to use executable_path() from platform.h
- Scripts now load correctly when working directory differs from executable
- Issue #76: Fix UIEntityCollection returns wrong type
- Updated UIEntityCollectionIter::next() to check for stored Python object
- Derived Entity classes now preserve their type when retrieved from collections
- Issue #9: Recreate RenderTexture when resized (already fixed)
- Confirmed RenderTexture recreation already implemented in set_size() and set_float_member()
- Uses 1.5x padding and 4096 max size limit
- Issue #79: Fix Color r, g, b, a properties return None
- Implemented get_member() and set_member() in PyColor.cpp
- Color component properties now work correctly with proper validation
- Additional fix: Grid.at() method signature
- Changed from METH_O to METH_VARARGS to accept two arguments
All fixes include comprehensive tests to verify functionality.
closes #37, closes #76, closes #9, closes #79
2025-07-05 17:30:49 -04:00
|
|
|
// Recreate renderTexture when width changes
|
|
|
|
|
unsigned int tex_width = static_cast<unsigned int>(val * 1.5f);
|
|
|
|
|
unsigned int tex_height = static_cast<unsigned int>(self->data->box.getSize().y * 1.5f);
|
|
|
|
|
tex_width = std::min(tex_width, 4096u);
|
|
|
|
|
tex_height = std::min(tex_height, 4096u);
|
|
|
|
|
self->data->renderTexture.create(tex_width, tex_height);
|
|
|
|
|
}
|
2024-04-20 10:32:04 -04:00
|
|
|
else if (member_ptr == 3) // h
|
Squashed commit of the following: [alpha_streamline_1]
the low-hanging fruit of pre-existing issues and standardizing the
Python interfaces
Special thanks to Claude Code, ~100k output tokens for this merge
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 99f301e3a0e9e81ad28c9e1d410390c32dfd933c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:25:32 2025 -0400
Add position tuple support and pos property to UI elements
closes #83, closes #84
- Issue #83: Add position tuple support to constructors
- Frame and Sprite now accept both (x, y) and ((x, y)) forms
- Also accept Vector objects as position arguments
- Caption and Entity already supported tuple/Vector forms
- Uses PyVector::from_arg for flexible position parsing
- Issue #84: Add pos property to Frame and Sprite
- Added pos getter that returns a Vector
- Added pos setter that accepts Vector or tuple
- Provides consistency with Caption and Entity which already had pos properties
- All UI elements now have a uniform way to get/set positions as Vectors
Both features improve API consistency and make it easier to work with positions.
commit 2f2b488fb54da12c39c0010dbd83cb9f6c429b01
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:18:10 2025 -0400
Standardize sprite_index property and add scale_x/scale_y to UISprite
closes #81, closes #82
- Issue #81: Standardized property name to sprite_index across UISprite and UIEntity
- Added sprite_index as the primary property name
- Kept sprite_number as a deprecated alias for backward compatibility
- Updated repr() methods to use sprite_index
- Updated animation system to recognize both names
- Issue #82: Added scale_x and scale_y properties to UISprite
- Enables non-uniform scaling of sprites
- scale property still works for uniform scaling
- Both properties work with the animation system
All existing code using sprite_number continues to work due to backward compatibility.
commit 5a003a9aa587eb8ee4b79ac67ca8f342ab62e2d2
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:09:52 2025 -0400
Fix multiple low priority issues
closes #12, closes #80, closes #95, closes #96, closes #99
- Issue #12: Set tp_new to NULL for GridPoint and GridPointState to prevent instantiation from Python
- Issue #80: Renamed Caption.size to Caption.font_size for semantic clarity
- Issue #95: Fixed UICollection repr to show actual derived types instead of generic UIDrawable
- Issue #96: Added extend() method to UICollection for API consistency with UIEntityCollection
- Issue #99: Exposed read-only properties for Texture (sprite_width, sprite_height, sheet_width, sheet_height, sprite_count, source) and Font (family, source)
All issues have corresponding tests that verify the fixes work correctly.
commit e5affaf317665395135c936bc4a6b840ae321765
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 15:50:09 2025 -0400
Fix critical issues: script loading, entity types, and color properties
- Issue #37: Fix Windows scripts subdirectory not checked
- Updated executeScript() to use executable_path() from platform.h
- Scripts now load correctly when working directory differs from executable
- Issue #76: Fix UIEntityCollection returns wrong type
- Updated UIEntityCollectionIter::next() to check for stored Python object
- Derived Entity classes now preserve their type when retrieved from collections
- Issue #9: Recreate RenderTexture when resized (already fixed)
- Confirmed RenderTexture recreation already implemented in set_size() and set_float_member()
- Uses 1.5x padding and 4096 max size limit
- Issue #79: Fix Color r, g, b, a properties return None
- Implemented get_member() and set_member() in PyColor.cpp
- Color component properties now work correctly with proper validation
- Additional fix: Grid.at() method signature
- Changed from METH_O to METH_VARARGS to accept two arguments
All fixes include comprehensive tests to verify functionality.
closes #37, closes #76, closes #9, closes #79
2025-07-05 17:30:49 -04:00
|
|
|
{
|
2024-04-20 10:32:04 -04:00
|
|
|
self->data->box.setSize(sf::Vector2f(self->data->box.getSize().x, val));
|
Squashed commit of the following: [alpha_streamline_1]
the low-hanging fruit of pre-existing issues and standardizing the
Python interfaces
Special thanks to Claude Code, ~100k output tokens for this merge
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 99f301e3a0e9e81ad28c9e1d410390c32dfd933c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:25:32 2025 -0400
Add position tuple support and pos property to UI elements
closes #83, closes #84
- Issue #83: Add position tuple support to constructors
- Frame and Sprite now accept both (x, y) and ((x, y)) forms
- Also accept Vector objects as position arguments
- Caption and Entity already supported tuple/Vector forms
- Uses PyVector::from_arg for flexible position parsing
- Issue #84: Add pos property to Frame and Sprite
- Added pos getter that returns a Vector
- Added pos setter that accepts Vector or tuple
- Provides consistency with Caption and Entity which already had pos properties
- All UI elements now have a uniform way to get/set positions as Vectors
Both features improve API consistency and make it easier to work with positions.
commit 2f2b488fb54da12c39c0010dbd83cb9f6c429b01
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:18:10 2025 -0400
Standardize sprite_index property and add scale_x/scale_y to UISprite
closes #81, closes #82
- Issue #81: Standardized property name to sprite_index across UISprite and UIEntity
- Added sprite_index as the primary property name
- Kept sprite_number as a deprecated alias for backward compatibility
- Updated repr() methods to use sprite_index
- Updated animation system to recognize both names
- Issue #82: Added scale_x and scale_y properties to UISprite
- Enables non-uniform scaling of sprites
- scale property still works for uniform scaling
- Both properties work with the animation system
All existing code using sprite_number continues to work due to backward compatibility.
commit 5a003a9aa587eb8ee4b79ac67ca8f342ab62e2d2
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 16:09:52 2025 -0400
Fix multiple low priority issues
closes #12, closes #80, closes #95, closes #96, closes #99
- Issue #12: Set tp_new to NULL for GridPoint and GridPointState to prevent instantiation from Python
- Issue #80: Renamed Caption.size to Caption.font_size for semantic clarity
- Issue #95: Fixed UICollection repr to show actual derived types instead of generic UIDrawable
- Issue #96: Added extend() method to UICollection for API consistency with UIEntityCollection
- Issue #99: Exposed read-only properties for Texture (sprite_width, sprite_height, sheet_width, sheet_height, sprite_count, source) and Font (family, source)
All issues have corresponding tests that verify the fixes work correctly.
commit e5affaf317665395135c936bc4a6b840ae321765
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 15:50:09 2025 -0400
Fix critical issues: script loading, entity types, and color properties
- Issue #37: Fix Windows scripts subdirectory not checked
- Updated executeScript() to use executable_path() from platform.h
- Scripts now load correctly when working directory differs from executable
- Issue #76: Fix UIEntityCollection returns wrong type
- Updated UIEntityCollectionIter::next() to check for stored Python object
- Derived Entity classes now preserve their type when retrieved from collections
- Issue #9: Recreate RenderTexture when resized (already fixed)
- Confirmed RenderTexture recreation already implemented in set_size() and set_float_member()
- Uses 1.5x padding and 4096 max size limit
- Issue #79: Fix Color r, g, b, a properties return None
- Implemented get_member() and set_member() in PyColor.cpp
- Color component properties now work correctly with proper validation
- Additional fix: Grid.at() method signature
- Changed from METH_O to METH_VARARGS to accept two arguments
All fixes include comprehensive tests to verify functionality.
closes #37, closes #76, closes #9, closes #79
2025-07-05 17:30:49 -04:00
|
|
|
// Recreate renderTexture when height changes
|
|
|
|
|
unsigned int tex_width = static_cast<unsigned int>(self->data->box.getSize().x * 1.5f);
|
|
|
|
|
unsigned int tex_height = static_cast<unsigned int>(val * 1.5f);
|
|
|
|
|
tex_width = std::min(tex_width, 4096u);
|
|
|
|
|
tex_height = std::min(tex_height, 4096u);
|
|
|
|
|
self->data->renderTexture.create(tex_width, tex_height);
|
|
|
|
|
}
|
2024-04-20 10:32:04 -04:00
|
|
|
else if (member_ptr == 4) // center_x
|
|
|
|
|
self->data->center_x = val;
|
|
|
|
|
else if (member_ptr == 5) // center_y
|
|
|
|
|
self->data->center_y = val;
|
|
|
|
|
else if (member_ptr == 6) // zoom
|
|
|
|
|
self->data->zoom = val;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
// TODO (7DRL Day 2, item 5.) return Texture object
|
|
|
|
|
/*
|
|
|
|
|
PyObject* UIGrid::get_texture(PyUIGridObject* self, void* closure) {
|
|
|
|
|
Py_INCREF(self->texture);
|
|
|
|
|
return self->texture;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::get_texture(PyUIGridObject* self, void* closure) {
|
|
|
|
|
//return self->data->getTexture()->pyObject();
|
|
|
|
|
// PyObject_GetAttrString(McRFPy_API::mcrf_module, "GridPointState")
|
|
|
|
|
//PyTextureObject* obj = (PyTextureObject*)((&PyTextureType)->tp_alloc(&PyTextureType, 0));
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
|
|
|
|
|
// Return None if no texture
|
|
|
|
|
auto texture = self->data->getTexture();
|
|
|
|
|
if (!texture) {
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "Texture");
|
|
|
|
|
auto obj = (PyTextureObject*)type->tp_alloc(type, 0);
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
obj->data = texture;
|
2024-04-20 10:32:04 -04:00
|
|
|
return (PyObject*)obj;
|
|
|
|
|
}
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
PyObject* UIGrid::py_at(PyUIGridObject* self, PyObject* args, PyObject* kwds)
|
2024-04-20 10:32:04 -04:00
|
|
|
{
|
2026-01-05 10:16:16 -05:00
|
|
|
int x, y;
|
|
|
|
|
|
|
|
|
|
// Use the flexible position parsing helper - accepts:
|
|
|
|
|
// at(x, y), at((x, y)), at([x, y]), at(Vector(x, y)), at(pos=(x, y)), etc.
|
|
|
|
|
if (!PyPosition_ParseInt(args, kwds, &x, &y)) {
|
|
|
|
|
return NULL; // Error already set by PyPosition_ParseInt
|
2024-04-20 10:32:04 -04:00
|
|
|
}
|
2026-01-05 10:16:16 -05:00
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Range validation
|
2026-01-06 10:21:50 -05:00
|
|
|
if (x < 0 || x >= self->data->grid_w) {
|
|
|
|
|
PyErr_Format(PyExc_IndexError, "x index %d is out of range [0, %d)", x, self->data->grid_w);
|
2024-04-20 10:32:04 -04:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2026-01-06 10:21:50 -05:00
|
|
|
if (y < 0 || y >= self->data->grid_h) {
|
|
|
|
|
PyErr_Format(PyExc_IndexError, "y index %d is out of range [0, %d)", y, self->data->grid_h);
|
2024-04-20 10:32:04 -04:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-06 04:38:56 -05:00
|
|
|
// Use the type directly since GridPoint is internal-only (not exported to module)
|
|
|
|
|
auto type = &mcrfpydef::PyUIGridPointType;
|
2024-04-20 10:32:04 -04:00
|
|
|
auto obj = (PyUIGridPointObject*)type->tp_alloc(type, 0);
|
|
|
|
|
//auto target = std::static_pointer_cast<UIEntity>(target);
|
2025-11-28 22:33:16 -05:00
|
|
|
// #123 - Use at() method to route through chunks for large grids
|
|
|
|
|
obj->data = &(self->data->at(x, y));
|
2024-04-20 10:32:04 -04:00
|
|
|
obj->grid = self->data;
|
|
|
|
|
return (PyObject*)obj;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-10 08:37:31 -05:00
|
|
|
// Grid subscript access: grid[x, y] -> GridPoint
|
|
|
|
|
// Enables Pythonic cell access syntax
|
|
|
|
|
PyObject* UIGrid::subscript(PyUIGridObject* self, PyObject* key)
|
|
|
|
|
{
|
|
|
|
|
// We expect a tuple of (x, y)
|
|
|
|
|
if (!PyTuple_Check(key) || PyTuple_Size(key) != 2) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "Grid indices must be a tuple of (x, y)");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* x_obj = PyTuple_GetItem(key, 0);
|
|
|
|
|
PyObject* y_obj = PyTuple_GetItem(key, 1);
|
|
|
|
|
|
|
|
|
|
if (!PyLong_Check(x_obj) || !PyLong_Check(y_obj)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "Grid indices must be integers");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int x = PyLong_AsLong(x_obj);
|
|
|
|
|
int y = PyLong_AsLong(y_obj);
|
|
|
|
|
|
|
|
|
|
// Range validation
|
|
|
|
|
if (x < 0 || x >= self->data->grid_w) {
|
|
|
|
|
PyErr_Format(PyExc_IndexError, "x index %d is out of range [0, %d)", x, self->data->grid_w);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (y < 0 || y >= self->data->grid_h) {
|
|
|
|
|
PyErr_Format(PyExc_IndexError, "y index %d is out of range [0, %d)", y, self->data->grid_h);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create GridPoint object (same as py_at)
|
|
|
|
|
auto type = &mcrfpydef::PyUIGridPointType;
|
|
|
|
|
auto obj = (PyUIGridPointObject*)type->tp_alloc(type, 0);
|
|
|
|
|
if (!obj) return NULL;
|
|
|
|
|
|
|
|
|
|
obj->data = &(self->data->at(x, y));
|
|
|
|
|
obj->grid = self->data;
|
|
|
|
|
return (PyObject*)obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Mapping methods for grid[x, y] subscript access
|
|
|
|
|
PyMappingMethods UIGrid::mpmethods = {
|
|
|
|
|
.mp_length = NULL, // No len() for grid via mapping (use grid_w * grid_h)
|
|
|
|
|
.mp_subscript = (binaryfunc)UIGrid::subscript,
|
|
|
|
|
.mp_ass_subscript = NULL // No assignment via subscript (use grid[x,y].property = value)
|
|
|
|
|
};
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
PyObject* UIGrid::get_fill_color(PyUIGridObject* self, void* closure)
|
|
|
|
|
{
|
|
|
|
|
auto& color = self->data->fill_color;
|
|
|
|
|
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "Color");
|
|
|
|
|
PyObject* args = Py_BuildValue("(iiii)", color.r, color.g, color.b, color.a);
|
|
|
|
|
PyObject* obj = PyObject_CallObject((PyObject*)type, args);
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
Py_DECREF(type);
|
|
|
|
|
return obj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_fill_color(PyUIGridObject* self, PyObject* value, void* closure)
|
|
|
|
|
{
|
|
|
|
|
if (!PyObject_IsInstance(value, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Color"))) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "fill_color must be a Color object");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyColorObject* color = (PyColorObject*)value;
|
|
|
|
|
self->data->fill_color = color->data;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::get_perspective(PyUIGridObject* self, void* closure)
|
|
|
|
|
{
|
2025-07-21 23:47:21 -04:00
|
|
|
auto locked = self->data->perspective_entity.lock();
|
|
|
|
|
if (locked) {
|
|
|
|
|
// Check cache first to preserve derived class
|
|
|
|
|
if (locked->serial_number != 0) {
|
|
|
|
|
PyObject* cached = PythonObjectCache::getInstance().lookup(locked->serial_number);
|
|
|
|
|
if (cached) {
|
|
|
|
|
return cached; // Already INCREF'd by lookup
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Legacy: If the entity has a stored Python object reference
|
|
|
|
|
if (locked->self != nullptr) {
|
|
|
|
|
Py_INCREF(locked->self);
|
|
|
|
|
return locked->self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Otherwise, create a new base Entity object
|
|
|
|
|
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity");
|
|
|
|
|
auto o = (PyUIEntityObject*)type->tp_alloc(type, 0);
|
|
|
|
|
if (o) {
|
|
|
|
|
o->data = locked;
|
|
|
|
|
o->weakreflist = NULL;
|
|
|
|
|
Py_DECREF(type);
|
|
|
|
|
return (PyObject*)o;
|
|
|
|
|
}
|
|
|
|
|
Py_XDECREF(type);
|
|
|
|
|
}
|
|
|
|
|
Py_RETURN_NONE;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_perspective(PyUIGridObject* self, PyObject* value, void* closure)
|
|
|
|
|
{
|
2025-07-21 23:47:21 -04:00
|
|
|
if (value == Py_None) {
|
|
|
|
|
// Clear perspective but keep perspective_enabled unchanged
|
|
|
|
|
self->data->perspective_entity.reset();
|
|
|
|
|
return 0;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
}
|
|
|
|
|
|
2025-07-21 23:47:21 -04:00
|
|
|
// Extract UIEntity from PyObject
|
|
|
|
|
// Get the Entity type from the module
|
|
|
|
|
auto entity_type = PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity");
|
|
|
|
|
if (!entity_type) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "Could not get Entity type from mcrfpy module");
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-21 23:47:21 -04:00
|
|
|
if (!PyObject_IsInstance(value, entity_type)) {
|
|
|
|
|
Py_DECREF(entity_type);
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "perspective must be a UIEntity or None");
|
|
|
|
|
return -1;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
}
|
2025-07-21 23:47:21 -04:00
|
|
|
Py_DECREF(entity_type);
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
|
2025-07-21 23:47:21 -04:00
|
|
|
PyUIEntityObject* entity_obj = (PyUIEntityObject*)value;
|
|
|
|
|
self->data->perspective_entity = entity_obj->data;
|
|
|
|
|
self->data->perspective_enabled = true; // Enable perspective when entity assigned
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::get_perspective_enabled(PyUIGridObject* self, void* closure)
|
|
|
|
|
{
|
|
|
|
|
return PyBool_FromLong(self->data->perspective_enabled);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_perspective_enabled(PyUIGridObject* self, PyObject* value, void* closure)
|
|
|
|
|
{
|
|
|
|
|
int enabled = PyObject_IsTrue(value);
|
|
|
|
|
if (enabled == -1) {
|
|
|
|
|
return -1; // Error occurred
|
|
|
|
|
}
|
|
|
|
|
self->data->perspective_enabled = enabled;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
feat: Implement FOV enum and layer draw_fov for #114 and #113
Phase 1 - FOV Enum System:
- Create PyFOV.h/cpp with mcrfpy.FOV IntEnum (BASIC, DIAMOND, SHADOW, etc.)
- Add mcrfpy.default_fov module property initialized to FOV.BASIC
- Add grid.fov and grid.fov_radius properties for per-grid defaults
- Remove deprecated module-level FOV_* constants (breaking change)
Phase 2 - Layer Operations:
- Implement ColorLayer.fill_rect(pos, size, color) for rectangle fills
- Implement TileLayer.fill_rect(pos, size, index) for tile rectangle fills
- Implement ColorLayer.draw_fov(source, radius, fov, visible, discovered, unknown)
to paint FOV-based visibility on color layers using parent grid's TCOD map
The FOV enum uses Python's IntEnum for type safety while maintaining
backward compatibility with integer values. Tests updated to use new API.
Addresses #114 (FOV enum), #113 (layer operations)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 15:18:10 -05:00
|
|
|
// #114 - FOV algorithm property
|
|
|
|
|
PyObject* UIGrid::get_fov(PyUIGridObject* self, void* closure)
|
|
|
|
|
{
|
|
|
|
|
// Return the FOV enum member for the current algorithm
|
|
|
|
|
if (PyFOV::fov_enum_class) {
|
|
|
|
|
// Get the enum member by value
|
|
|
|
|
PyObject* value = PyLong_FromLong(self->data->fov_algorithm);
|
|
|
|
|
if (!value) return NULL;
|
|
|
|
|
|
|
|
|
|
// Call FOV(value) to get the enum member
|
|
|
|
|
PyObject* args = PyTuple_Pack(1, value);
|
|
|
|
|
Py_DECREF(value);
|
|
|
|
|
if (!args) return NULL;
|
|
|
|
|
|
|
|
|
|
PyObject* result = PyObject_Call(PyFOV::fov_enum_class, args, NULL);
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
// Fallback to integer
|
|
|
|
|
return PyLong_FromLong(self->data->fov_algorithm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_fov(PyUIGridObject* self, PyObject* value, void* closure)
|
|
|
|
|
{
|
|
|
|
|
TCOD_fov_algorithm_t algo;
|
|
|
|
|
if (!PyFOV::from_arg(value, &algo, nullptr)) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
self->data->fov_algorithm = algo;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// #114 - FOV radius property
|
|
|
|
|
PyObject* UIGrid::get_fov_radius(PyUIGridObject* self, void* closure)
|
|
|
|
|
{
|
|
|
|
|
return PyLong_FromLong(self->data->fov_radius);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_fov_radius(PyUIGridObject* self, PyObject* value, void* closure)
|
|
|
|
|
{
|
|
|
|
|
if (!PyLong_Check(value)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "fov_radius must be an integer");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
long radius = PyLong_AsLong(value);
|
|
|
|
|
if (radius == -1 && PyErr_Occurred()) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (radius < 0) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError, "fov_radius must be non-negative");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
self->data->fov_radius = (int)radius;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Python API implementations for TCOD functionality
|
|
|
|
|
PyObject* UIGrid::py_compute_fov(PyUIGridObject* self, PyObject* args, PyObject* kwds)
|
|
|
|
|
{
|
2026-01-05 10:16:16 -05:00
|
|
|
static const char* kwlist[] = {"pos", "radius", "light_walls", "algorithm", NULL};
|
|
|
|
|
PyObject* pos_obj = NULL;
|
|
|
|
|
int radius = 0;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
int light_walls = 1;
|
|
|
|
|
int algorithm = FOV_BASIC;
|
2026-01-05 10:16:16 -05:00
|
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|ipi", const_cast<char**>(kwlist),
|
|
|
|
|
&pos_obj, &radius, &light_walls, &algorithm)) {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2026-01-05 10:16:16 -05:00
|
|
|
|
|
|
|
|
int x, y;
|
|
|
|
|
if (!PyPosition_FromObjectInt(pos_obj, &x, &y)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-22 23:00:34 -04:00
|
|
|
// Compute FOV
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
self->data->computeFOV(x, y, radius, light_walls, (TCOD_fov_algorithm_t)algorithm);
|
2025-11-28 21:26:32 -05:00
|
|
|
|
|
|
|
|
// Return None - use is_in_fov() to query visibility
|
|
|
|
|
// See issue #146: returning a list had O(grid_size) performance
|
|
|
|
|
Py_RETURN_NONE;
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
}
|
|
|
|
|
|
2026-01-05 10:16:16 -05:00
|
|
|
PyObject* UIGrid::py_is_in_fov(PyUIGridObject* self, PyObject* args, PyObject* kwds)
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
{
|
|
|
|
|
int x, y;
|
2026-01-05 10:16:16 -05:00
|
|
|
if (!PyPosition_ParseInt(args, kwds, &x, &y)) {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2026-01-05 10:16:16 -05:00
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
bool in_fov = self->data->isInFOV(x, y);
|
|
|
|
|
return PyBool_FromLong(in_fov);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-10 22:09:45 -05:00
|
|
|
// Old pathfinding Python methods removed - see UIGridPathfinding.cpp for new implementation
|
|
|
|
|
// Grid.find_path() now returns AStarPath objects
|
|
|
|
|
// Grid.get_dijkstra_map() returns DijkstraMap objects (cached by root)
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
|
2025-11-28 21:35:38 -05:00
|
|
|
// #147 - Layer system Python API
|
|
|
|
|
PyObject* UIGrid::py_add_layer(PyUIGridObject* self, PyObject* args, PyObject* kwds) {
|
|
|
|
|
static const char* kwlist[] = {"type", "z_index", "texture", NULL};
|
|
|
|
|
const char* type_str = nullptr;
|
|
|
|
|
int z_index = -1;
|
|
|
|
|
PyObject* texture_obj = nullptr;
|
|
|
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|iO", const_cast<char**>(kwlist),
|
|
|
|
|
&type_str, &z_index, &texture_obj)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string type(type_str);
|
|
|
|
|
|
|
|
|
|
if (type == "color") {
|
|
|
|
|
auto layer = self->data->addColorLayer(z_index);
|
|
|
|
|
|
|
|
|
|
// Create Python ColorLayer object
|
|
|
|
|
auto* color_layer_type = (PyTypeObject*)PyObject_GetAttrString(
|
|
|
|
|
PyImport_ImportModule("mcrfpy"), "ColorLayer");
|
|
|
|
|
if (!color_layer_type) return NULL;
|
|
|
|
|
|
|
|
|
|
PyColorLayerObject* py_layer = (PyColorLayerObject*)color_layer_type->tp_alloc(color_layer_type, 0);
|
|
|
|
|
Py_DECREF(color_layer_type);
|
|
|
|
|
if (!py_layer) return NULL;
|
|
|
|
|
|
|
|
|
|
py_layer->data = layer;
|
|
|
|
|
py_layer->grid = self->data;
|
|
|
|
|
return (PyObject*)py_layer;
|
|
|
|
|
|
|
|
|
|
} else if (type == "tile") {
|
|
|
|
|
// Parse texture
|
|
|
|
|
std::shared_ptr<PyTexture> texture;
|
|
|
|
|
if (texture_obj && texture_obj != Py_None) {
|
|
|
|
|
auto* mcrfpy_module = PyImport_ImportModule("mcrfpy");
|
|
|
|
|
if (!mcrfpy_module) return NULL;
|
|
|
|
|
|
|
|
|
|
auto* texture_type = PyObject_GetAttrString(mcrfpy_module, "Texture");
|
|
|
|
|
Py_DECREF(mcrfpy_module);
|
|
|
|
|
if (!texture_type) return NULL;
|
|
|
|
|
|
|
|
|
|
if (!PyObject_IsInstance(texture_obj, texture_type)) {
|
|
|
|
|
Py_DECREF(texture_type);
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "texture must be a Texture object");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
Py_DECREF(texture_type);
|
|
|
|
|
texture = ((PyTextureObject*)texture_obj)->data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto layer = self->data->addTileLayer(z_index, texture);
|
|
|
|
|
|
|
|
|
|
// Create Python TileLayer object
|
|
|
|
|
auto* tile_layer_type = (PyTypeObject*)PyObject_GetAttrString(
|
|
|
|
|
PyImport_ImportModule("mcrfpy"), "TileLayer");
|
|
|
|
|
if (!tile_layer_type) return NULL;
|
|
|
|
|
|
|
|
|
|
PyTileLayerObject* py_layer = (PyTileLayerObject*)tile_layer_type->tp_alloc(tile_layer_type, 0);
|
|
|
|
|
Py_DECREF(tile_layer_type);
|
|
|
|
|
if (!py_layer) return NULL;
|
|
|
|
|
|
|
|
|
|
py_layer->data = layer;
|
|
|
|
|
py_layer->grid = self->data;
|
|
|
|
|
return (PyObject*)py_layer;
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError, "type must be 'color' or 'tile'");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::py_remove_layer(PyUIGridObject* self, PyObject* args) {
|
|
|
|
|
PyObject* layer_obj;
|
|
|
|
|
if (!PyArg_ParseTuple(args, "O", &layer_obj)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto* mcrfpy_module = PyImport_ImportModule("mcrfpy");
|
|
|
|
|
if (!mcrfpy_module) return NULL;
|
|
|
|
|
|
|
|
|
|
// Check if ColorLayer
|
|
|
|
|
auto* color_layer_type = PyObject_GetAttrString(mcrfpy_module, "ColorLayer");
|
|
|
|
|
if (color_layer_type && PyObject_IsInstance(layer_obj, color_layer_type)) {
|
|
|
|
|
Py_DECREF(color_layer_type);
|
|
|
|
|
Py_DECREF(mcrfpy_module);
|
|
|
|
|
auto* py_layer = (PyColorLayerObject*)layer_obj;
|
|
|
|
|
self->data->removeLayer(py_layer->data);
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
if (color_layer_type) Py_DECREF(color_layer_type);
|
|
|
|
|
|
|
|
|
|
// Check if TileLayer
|
|
|
|
|
auto* tile_layer_type = PyObject_GetAttrString(mcrfpy_module, "TileLayer");
|
|
|
|
|
if (tile_layer_type && PyObject_IsInstance(layer_obj, tile_layer_type)) {
|
|
|
|
|
Py_DECREF(tile_layer_type);
|
|
|
|
|
Py_DECREF(mcrfpy_module);
|
|
|
|
|
auto* py_layer = (PyTileLayerObject*)layer_obj;
|
|
|
|
|
self->data->removeLayer(py_layer->data);
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
if (tile_layer_type) Py_DECREF(tile_layer_type);
|
|
|
|
|
|
|
|
|
|
Py_DECREF(mcrfpy_module);
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "layer must be a ColorLayer or TileLayer");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::get_layers(PyUIGridObject* self, void* closure) {
|
|
|
|
|
self->data->sortLayers();
|
|
|
|
|
|
|
|
|
|
PyObject* list = PyList_New(self->data->layers.size());
|
|
|
|
|
if (!list) return NULL;
|
|
|
|
|
|
|
|
|
|
auto* mcrfpy_module = PyImport_ImportModule("mcrfpy");
|
|
|
|
|
if (!mcrfpy_module) {
|
|
|
|
|
Py_DECREF(list);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto* color_layer_type = (PyTypeObject*)PyObject_GetAttrString(mcrfpy_module, "ColorLayer");
|
|
|
|
|
auto* tile_layer_type = (PyTypeObject*)PyObject_GetAttrString(mcrfpy_module, "TileLayer");
|
|
|
|
|
Py_DECREF(mcrfpy_module);
|
|
|
|
|
|
|
|
|
|
if (!color_layer_type || !tile_layer_type) {
|
|
|
|
|
if (color_layer_type) Py_DECREF(color_layer_type);
|
|
|
|
|
if (tile_layer_type) Py_DECREF(tile_layer_type);
|
|
|
|
|
Py_DECREF(list);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < self->data->layers.size(); ++i) {
|
|
|
|
|
auto& layer = self->data->layers[i];
|
|
|
|
|
PyObject* py_layer = nullptr;
|
|
|
|
|
|
|
|
|
|
if (layer->type == GridLayerType::Color) {
|
|
|
|
|
PyColorLayerObject* obj = (PyColorLayerObject*)color_layer_type->tp_alloc(color_layer_type, 0);
|
|
|
|
|
if (obj) {
|
|
|
|
|
obj->data = std::static_pointer_cast<ColorLayer>(layer);
|
|
|
|
|
obj->grid = self->data;
|
|
|
|
|
py_layer = (PyObject*)obj;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
PyTileLayerObject* obj = (PyTileLayerObject*)tile_layer_type->tp_alloc(tile_layer_type, 0);
|
|
|
|
|
if (obj) {
|
|
|
|
|
obj->data = std::static_pointer_cast<TileLayer>(layer);
|
|
|
|
|
obj->grid = self->data;
|
|
|
|
|
py_layer = (PyObject*)obj;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!py_layer) {
|
|
|
|
|
Py_DECREF(color_layer_type);
|
|
|
|
|
Py_DECREF(tile_layer_type);
|
|
|
|
|
Py_DECREF(list);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyList_SET_ITEM(list, i, py_layer); // Steals reference
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Py_DECREF(color_layer_type);
|
|
|
|
|
Py_DECREF(tile_layer_type);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::py_layer(PyUIGridObject* self, PyObject* args) {
|
|
|
|
|
int z_index;
|
|
|
|
|
if (!PyArg_ParseTuple(args, "i", &z_index)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (auto& layer : self->data->layers) {
|
|
|
|
|
if (layer->z_index == z_index) {
|
|
|
|
|
auto* mcrfpy_module = PyImport_ImportModule("mcrfpy");
|
|
|
|
|
if (!mcrfpy_module) return NULL;
|
|
|
|
|
|
|
|
|
|
if (layer->type == GridLayerType::Color) {
|
|
|
|
|
auto* type = (PyTypeObject*)PyObject_GetAttrString(mcrfpy_module, "ColorLayer");
|
|
|
|
|
Py_DECREF(mcrfpy_module);
|
|
|
|
|
if (!type) return NULL;
|
|
|
|
|
|
|
|
|
|
PyColorLayerObject* obj = (PyColorLayerObject*)type->tp_alloc(type, 0);
|
|
|
|
|
Py_DECREF(type);
|
|
|
|
|
if (!obj) return NULL;
|
|
|
|
|
|
|
|
|
|
obj->data = std::static_pointer_cast<ColorLayer>(layer);
|
|
|
|
|
obj->grid = self->data;
|
|
|
|
|
return (PyObject*)obj;
|
|
|
|
|
} else {
|
|
|
|
|
auto* type = (PyTypeObject*)PyObject_GetAttrString(mcrfpy_module, "TileLayer");
|
|
|
|
|
Py_DECREF(mcrfpy_module);
|
|
|
|
|
if (!type) return NULL;
|
|
|
|
|
|
|
|
|
|
PyTileLayerObject* obj = (PyTileLayerObject*)type->tp_alloc(type, 0);
|
|
|
|
|
Py_DECREF(type);
|
|
|
|
|
if (!obj) return NULL;
|
|
|
|
|
|
|
|
|
|
obj->data = std::static_pointer_cast<TileLayer>(layer);
|
|
|
|
|
obj->grid = self->data;
|
|
|
|
|
return (PyObject*)obj;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-28 00:44:07 -05:00
|
|
|
// #115 - Spatial hash query for entities in radius
|
|
|
|
|
PyObject* UIGrid::py_entities_in_radius(PyUIGridObject* self, PyObject* args, PyObject* kwds)
|
|
|
|
|
{
|
|
|
|
|
static const char* kwlist[] = {"x", "y", "radius", NULL};
|
|
|
|
|
float x, y, radius;
|
|
|
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff", const_cast<char**>(kwlist),
|
|
|
|
|
&x, &y, &radius)) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (radius < 0) {
|
|
|
|
|
PyErr_SetString(PyExc_ValueError, "radius must be non-negative");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Query spatial hash for entities in radius
|
|
|
|
|
auto entities = self->data->spatial_hash.queryRadius(x, y, radius);
|
|
|
|
|
|
|
|
|
|
// Create result list
|
|
|
|
|
PyObject* result = PyList_New(entities.size());
|
|
|
|
|
if (!result) return PyErr_NoMemory();
|
|
|
|
|
|
|
|
|
|
// Cache Entity type for efficiency
|
|
|
|
|
static PyTypeObject* cached_entity_type = nullptr;
|
|
|
|
|
if (!cached_entity_type) {
|
|
|
|
|
cached_entity_type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity");
|
|
|
|
|
if (!cached_entity_type) {
|
|
|
|
|
Py_DECREF(result);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
Py_INCREF(cached_entity_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_t i = 0; i < entities.size(); i++) {
|
|
|
|
|
auto& entity = entities[i];
|
|
|
|
|
|
|
|
|
|
// Return stored Python object if it exists
|
|
|
|
|
if (entity->self != nullptr) {
|
|
|
|
|
Py_INCREF(entity->self);
|
|
|
|
|
PyList_SET_ITEM(result, i, entity->self);
|
|
|
|
|
} else {
|
|
|
|
|
// Create new Python Entity wrapper
|
|
|
|
|
auto pyEntity = (PyUIEntityObject*)cached_entity_type->tp_alloc(cached_entity_type, 0);
|
|
|
|
|
if (!pyEntity) {
|
|
|
|
|
Py_DECREF(result);
|
|
|
|
|
return PyErr_NoMemory();
|
|
|
|
|
}
|
|
|
|
|
pyEntity->data = entity;
|
|
|
|
|
pyEntity->weakreflist = NULL;
|
|
|
|
|
PyList_SET_ITEM(result, i, (PyObject*)pyEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
feat: Grid camera defaults to tile (0,0) at top-left + center_camera() method (#169)
Changes:
- Default Grid center now positions tile (0,0) at widget's top-left corner
- Added center_camera() method to center grid's middle tile at view center
- Added center_camera((tile_x, tile_y)) to position tile at top-left of widget
- Uses NaN as sentinel to detect if user provided center values in kwargs
- Animation-compatible: center_camera() just sets center property, no special state
Behavior:
- center_camera() → grid's center tile at view center
- center_camera((0, 0)) → tile (0,0) at top-left corner
- center_camera((5, 10)) → tile (5,10) at top-left corner
Before: Grid(size=(320,240)) showed 3/4 of content off-screen (center=0,0)
After: Grid(size=(320,240)) shows tile (0,0) at top-left (center=160,120)
Closes #169
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:30:51 -05:00
|
|
|
// #169 - center_camera implementations
|
|
|
|
|
void UIGrid::center_camera() {
|
|
|
|
|
// Center on grid's middle tile
|
|
|
|
|
int cell_width = ptex ? ptex->sprite_width : DEFAULT_CELL_WIDTH;
|
|
|
|
|
int cell_height = ptex ? ptex->sprite_height : DEFAULT_CELL_HEIGHT;
|
2026-01-06 10:21:50 -05:00
|
|
|
center_x = (grid_w / 2.0f) * cell_width;
|
|
|
|
|
center_y = (grid_h / 2.0f) * cell_height;
|
feat: Grid camera defaults to tile (0,0) at top-left + center_camera() method (#169)
Changes:
- Default Grid center now positions tile (0,0) at widget's top-left corner
- Added center_camera() method to center grid's middle tile at view center
- Added center_camera((tile_x, tile_y)) to position tile at top-left of widget
- Uses NaN as sentinel to detect if user provided center values in kwargs
- Animation-compatible: center_camera() just sets center property, no special state
Behavior:
- center_camera() → grid's center tile at view center
- center_camera((0, 0)) → tile (0,0) at top-left corner
- center_camera((5, 10)) → tile (5,10) at top-left corner
Before: Grid(size=(320,240)) showed 3/4 of content off-screen (center=0,0)
After: Grid(size=(320,240)) shows tile (0,0) at top-left (center=160,120)
Closes #169
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:30:51 -05:00
|
|
|
markDirty(); // #144 - View change affects content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UIGrid::center_camera(float tile_x, float tile_y) {
|
|
|
|
|
// Position specified tile at top-left of widget
|
|
|
|
|
int cell_width = ptex ? ptex->sprite_width : DEFAULT_CELL_WIDTH;
|
|
|
|
|
int cell_height = ptex ? ptex->sprite_height : DEFAULT_CELL_HEIGHT;
|
|
|
|
|
// To put tile (tx, ty) at top-left: center = tile_pos + half_viewport
|
|
|
|
|
float half_viewport_x = box.getSize().x / zoom / 2.0f;
|
|
|
|
|
float half_viewport_y = box.getSize().y / zoom / 2.0f;
|
|
|
|
|
center_x = tile_x * cell_width + half_viewport_x;
|
|
|
|
|
center_y = tile_y * cell_height + half_viewport_y;
|
|
|
|
|
markDirty(); // #144 - View change affects content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::py_center_camera(PyUIGridObject* self, PyObject* args) {
|
|
|
|
|
PyObject* pos_arg = nullptr;
|
|
|
|
|
|
|
|
|
|
// Parse optional positional argument (tuple of tile coordinates)
|
|
|
|
|
if (!PyArg_ParseTuple(args, "|O", &pos_arg)) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pos_arg == nullptr || pos_arg == Py_None) {
|
|
|
|
|
// No args: center on grid's middle tile
|
|
|
|
|
self->data->center_camera();
|
|
|
|
|
} else if (PyTuple_Check(pos_arg) && PyTuple_Size(pos_arg) == 2) {
|
|
|
|
|
// Tuple provided: center on (tile_x, tile_y)
|
|
|
|
|
PyObject* x_obj = PyTuple_GetItem(pos_arg, 0);
|
|
|
|
|
PyObject* y_obj = PyTuple_GetItem(pos_arg, 1);
|
|
|
|
|
|
|
|
|
|
float tile_x, tile_y;
|
|
|
|
|
if (PyFloat_Check(x_obj)) {
|
|
|
|
|
tile_x = PyFloat_AsDouble(x_obj);
|
|
|
|
|
} else if (PyLong_Check(x_obj)) {
|
|
|
|
|
tile_x = (float)PyLong_AsLong(x_obj);
|
|
|
|
|
} else {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "tile coordinates must be numeric");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PyFloat_Check(y_obj)) {
|
|
|
|
|
tile_y = PyFloat_AsDouble(y_obj);
|
|
|
|
|
} else if (PyLong_Check(y_obj)) {
|
|
|
|
|
tile_y = (float)PyLong_AsLong(y_obj);
|
|
|
|
|
} else {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "tile coordinates must be numeric");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self->data->center_camera(tile_x, tile_y);
|
|
|
|
|
} else {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "center_camera() takes an optional tuple (tile_x, tile_y)");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-11 20:42:47 -05:00
|
|
|
// #199 - HeightMap application methods
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::py_apply_threshold(PyUIGridObject* self, PyObject* args, PyObject* kwds) {
|
|
|
|
|
static const char* keywords[] = {"source", "range", "walkable", "transparent", nullptr};
|
|
|
|
|
PyObject* source_obj = nullptr;
|
|
|
|
|
PyObject* range_obj = nullptr;
|
|
|
|
|
PyObject* walkable_obj = Py_None;
|
|
|
|
|
PyObject* transparent_obj = Py_None;
|
|
|
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO|OO", const_cast<char**>(keywords),
|
|
|
|
|
&source_obj, &range_obj, &walkable_obj, &transparent_obj)) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Validate source is a HeightMap
|
|
|
|
|
PyObject* heightmap_type = PyObject_GetAttrString(McRFPy_API::mcrf_module, "HeightMap");
|
|
|
|
|
if (!heightmap_type) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "HeightMap type not found in module");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
bool is_heightmap = PyObject_IsInstance(source_obj, heightmap_type);
|
|
|
|
|
Py_DECREF(heightmap_type);
|
|
|
|
|
if (!is_heightmap) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "source must be a HeightMap");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
PyHeightMapObject* hmap = (PyHeightMapObject*)source_obj;
|
|
|
|
|
|
|
|
|
|
if (!hmap->heightmap) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "HeightMap not initialized");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse range tuple
|
|
|
|
|
if (!PyTuple_Check(range_obj) || PyTuple_Size(range_obj) != 2) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "range must be a tuple of (min, max)");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float range_min = (float)PyFloat_AsDouble(PyTuple_GetItem(range_obj, 0));
|
|
|
|
|
float range_max = (float)PyFloat_AsDouble(PyTuple_GetItem(range_obj, 1));
|
|
|
|
|
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check size match
|
|
|
|
|
if (hmap->heightmap->w != self->data->grid_w || hmap->heightmap->h != self->data->grid_h) {
|
|
|
|
|
PyErr_Format(PyExc_ValueError,
|
|
|
|
|
"HeightMap size (%d, %d) does not match Grid size (%d, %d)",
|
|
|
|
|
hmap->heightmap->w, hmap->heightmap->h, self->data->grid_w, self->data->grid_h);
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse optional walkable/transparent booleans
|
|
|
|
|
bool set_walkable = (walkable_obj != Py_None);
|
|
|
|
|
bool set_transparent = (transparent_obj != Py_None);
|
|
|
|
|
bool walkable_value = false;
|
|
|
|
|
bool transparent_value = false;
|
|
|
|
|
|
|
|
|
|
if (set_walkable) {
|
|
|
|
|
walkable_value = PyObject_IsTrue(walkable_obj);
|
|
|
|
|
}
|
|
|
|
|
if (set_transparent) {
|
|
|
|
|
transparent_value = PyObject_IsTrue(transparent_obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Apply threshold
|
|
|
|
|
for (int y = 0; y < self->data->grid_h; y++) {
|
|
|
|
|
for (int x = 0; x < self->data->grid_w; x++) {
|
|
|
|
|
float value = TCOD_heightmap_get_value(hmap->heightmap, x, y);
|
|
|
|
|
if (value >= range_min && value <= range_max) {
|
|
|
|
|
UIGridPoint& point = self->data->at(x, y);
|
|
|
|
|
if (set_walkable) {
|
|
|
|
|
point.walkable = walkable_value;
|
|
|
|
|
}
|
|
|
|
|
if (set_transparent) {
|
|
|
|
|
point.transparent = transparent_value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Sync TCOD map if it exists
|
|
|
|
|
if (self->data->getTCODMap()) {
|
|
|
|
|
self->data->syncTCODMap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return self for chaining
|
|
|
|
|
Py_INCREF(self);
|
|
|
|
|
return (PyObject*)self;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::py_apply_ranges(PyUIGridObject* self, PyObject* args) {
|
|
|
|
|
PyObject* source_obj = nullptr;
|
|
|
|
|
PyObject* ranges_obj = nullptr;
|
|
|
|
|
|
|
|
|
|
if (!PyArg_ParseTuple(args, "OO", &source_obj, &ranges_obj)) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Validate source is a HeightMap
|
|
|
|
|
PyObject* heightmap_type = PyObject_GetAttrString(McRFPy_API::mcrf_module, "HeightMap");
|
|
|
|
|
if (!heightmap_type) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "HeightMap type not found in module");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
bool is_heightmap = PyObject_IsInstance(source_obj, heightmap_type);
|
|
|
|
|
Py_DECREF(heightmap_type);
|
|
|
|
|
if (!is_heightmap) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "source must be a HeightMap");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
PyHeightMapObject* hmap = (PyHeightMapObject*)source_obj;
|
|
|
|
|
|
|
|
|
|
if (!hmap->heightmap) {
|
|
|
|
|
PyErr_SetString(PyExc_RuntimeError, "HeightMap not initialized");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Validate ranges is a list
|
|
|
|
|
if (!PyList_Check(ranges_obj)) {
|
|
|
|
|
PyErr_SetString(PyExc_TypeError, "ranges must be a list");
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check size match
|
|
|
|
|
if (hmap->heightmap->w != self->data->grid_w || hmap->heightmap->h != self->data->grid_h) {
|
|
|
|
|
PyErr_Format(PyExc_ValueError,
|
|
|
|
|
"HeightMap size (%d, %d) does not match Grid size (%d, %d)",
|
|
|
|
|
hmap->heightmap->w, hmap->heightmap->h, self->data->grid_w, self->data->grid_h);
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse all ranges first to catch errors early
|
|
|
|
|
struct RangeEntry {
|
|
|
|
|
float min, max;
|
|
|
|
|
bool set_walkable, set_transparent;
|
|
|
|
|
bool walkable_value, transparent_value;
|
|
|
|
|
};
|
|
|
|
|
std::vector<RangeEntry> entries;
|
|
|
|
|
|
|
|
|
|
Py_ssize_t num_ranges = PyList_Size(ranges_obj);
|
|
|
|
|
for (Py_ssize_t i = 0; i < num_ranges; i++) {
|
|
|
|
|
PyObject* entry = PyList_GetItem(ranges_obj, i);
|
|
|
|
|
|
|
|
|
|
if (!PyTuple_Check(entry) || PyTuple_Size(entry) != 2) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"ranges[%zd] must be a tuple of (range, properties_dict)", i);
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* range_tuple = PyTuple_GetItem(entry, 0);
|
|
|
|
|
PyObject* props_dict = PyTuple_GetItem(entry, 1);
|
|
|
|
|
|
|
|
|
|
if (!PyTuple_Check(range_tuple) || PyTuple_Size(range_tuple) != 2) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"ranges[%zd] range must be a tuple of (min, max)", i);
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!PyDict_Check(props_dict)) {
|
|
|
|
|
PyErr_Format(PyExc_TypeError,
|
|
|
|
|
"ranges[%zd] properties must be a dict", i);
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RangeEntry re;
|
|
|
|
|
re.min = (float)PyFloat_AsDouble(PyTuple_GetItem(range_tuple, 0));
|
|
|
|
|
re.max = (float)PyFloat_AsDouble(PyTuple_GetItem(range_tuple, 1));
|
|
|
|
|
|
|
|
|
|
if (PyErr_Occurred()) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse walkable from dict
|
|
|
|
|
PyObject* walkable_val = PyDict_GetItemString(props_dict, "walkable");
|
|
|
|
|
re.set_walkable = (walkable_val != nullptr);
|
|
|
|
|
if (re.set_walkable) {
|
|
|
|
|
re.walkable_value = PyObject_IsTrue(walkable_val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Parse transparent from dict
|
|
|
|
|
PyObject* transparent_val = PyDict_GetItemString(props_dict, "transparent");
|
|
|
|
|
re.set_transparent = (transparent_val != nullptr);
|
|
|
|
|
if (re.set_transparent) {
|
|
|
|
|
re.transparent_value = PyObject_IsTrue(transparent_val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
entries.push_back(re);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Apply all ranges in a single pass
|
|
|
|
|
for (int y = 0; y < self->data->grid_h; y++) {
|
|
|
|
|
for (int x = 0; x < self->data->grid_w; x++) {
|
|
|
|
|
float value = TCOD_heightmap_get_value(hmap->heightmap, x, y);
|
|
|
|
|
UIGridPoint& point = self->data->at(x, y);
|
|
|
|
|
|
|
|
|
|
// Check each range (first match wins)
|
|
|
|
|
for (const auto& re : entries) {
|
|
|
|
|
if (value >= re.min && value <= re.max) {
|
|
|
|
|
if (re.set_walkable) {
|
|
|
|
|
point.walkable = re.walkable_value;
|
|
|
|
|
}
|
|
|
|
|
if (re.set_transparent) {
|
|
|
|
|
point.transparent = re.transparent_value;
|
|
|
|
|
}
|
|
|
|
|
break; // First matching range wins
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Sync TCOD map if it exists
|
|
|
|
|
if (self->data->getTCODMap()) {
|
|
|
|
|
self->data->syncTCODMap();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return self for chaining
|
|
|
|
|
Py_INCREF(self);
|
|
|
|
|
return (PyObject*)self;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
PyMethodDef UIGrid::methods[] = {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
{"at", (PyCFunction)UIGrid::py_at, METH_VARARGS | METH_KEYWORDS},
|
2025-11-28 21:35:38 -05:00
|
|
|
{"compute_fov", (PyCFunction)UIGrid::py_compute_fov, METH_VARARGS | METH_KEYWORDS,
|
2026-01-05 10:16:16 -05:00
|
|
|
"compute_fov(pos, radius: int = 0, light_walls: bool = True, algorithm: int = FOV_BASIC) -> None\n\n"
|
2025-11-28 21:35:38 -05:00
|
|
|
"Compute field of view from a position.\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Args:\n"
|
2026-01-05 10:16:16 -05:00
|
|
|
" pos: Position as (x, y) tuple, list, or Vector\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
" radius: Maximum view distance (0 = unlimited)\n"
|
|
|
|
|
" light_walls: Whether walls are lit when visible\n"
|
|
|
|
|
" algorithm: FOV algorithm to use (FOV_BASIC, FOV_DIAMOND, FOV_SHADOW, FOV_PERMISSIVE_0-8)\n\n"
|
2026-01-05 10:16:16 -05:00
|
|
|
"Updates the internal FOV state. Use is_in_fov(pos) to query visibility."},
|
|
|
|
|
{"is_in_fov", (PyCFunction)UIGrid::py_is_in_fov, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"is_in_fov(pos) -> bool\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Check if a cell is in the field of view.\n\n"
|
|
|
|
|
"Args:\n"
|
2026-01-05 10:16:16 -05:00
|
|
|
" pos: Position as (x, y) tuple, list, or Vector\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Returns:\n"
|
|
|
|
|
" True if the cell is visible, False otherwise\n\n"
|
|
|
|
|
"Must call compute_fov() first to calculate visibility."},
|
2026-01-10 22:09:45 -05:00
|
|
|
{"find_path", (PyCFunction)UIGridPathfinding::Grid_find_path, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"find_path(start, end, diagonal_cost: float = 1.41) -> AStarPath | None\n\n"
|
|
|
|
|
"Compute A* path between two points.\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Args:\n"
|
2026-01-10 22:09:45 -05:00
|
|
|
" start: Starting position as Vector, Entity, or (x, y) tuple\n"
|
|
|
|
|
" end: Target position as Vector, Entity, or (x, y) tuple\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
" diagonal_cost: Cost of diagonal movement (default: 1.41)\n\n"
|
|
|
|
|
"Returns:\n"
|
2026-01-10 22:09:45 -05:00
|
|
|
" AStarPath object if path exists, None otherwise.\n\n"
|
|
|
|
|
"The returned AStarPath can be iterated or walked step-by-step."},
|
|
|
|
|
{"get_dijkstra_map", (PyCFunction)UIGridPathfinding::Grid_get_dijkstra_map, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"get_dijkstra_map(root, diagonal_cost: float = 1.41) -> DijkstraMap\n\n"
|
|
|
|
|
"Get or create a Dijkstra distance map for a root position.\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Args:\n"
|
2026-01-10 22:09:45 -05:00
|
|
|
" root: Root position as Vector, Entity, or (x, y) tuple\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
" diagonal_cost: Cost of diagonal movement (default: 1.41)\n\n"
|
|
|
|
|
"Returns:\n"
|
2026-01-10 22:09:45 -05:00
|
|
|
" DijkstraMap object for querying distances and paths.\n\n"
|
|
|
|
|
"Grid caches DijkstraMaps by root position. Multiple requests for the\n"
|
|
|
|
|
"same root return the same cached map. Call clear_dijkstra_maps() after\n"
|
|
|
|
|
"changing grid walkability to invalidate the cache."},
|
|
|
|
|
{"clear_dijkstra_maps", (PyCFunction)UIGridPathfinding::Grid_clear_dijkstra_maps, METH_NOARGS,
|
|
|
|
|
"clear_dijkstra_maps() -> None\n\n"
|
|
|
|
|
"Clear all cached Dijkstra maps.\n\n"
|
|
|
|
|
"Call this after modifying grid cell walkability to ensure pathfinding\n"
|
|
|
|
|
"uses updated walkability data."},
|
2025-11-28 21:35:38 -05:00
|
|
|
{"add_layer", (PyCFunction)UIGrid::py_add_layer, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"add_layer(type: str, z_index: int = -1, texture: Texture = None) -> ColorLayer | TileLayer"},
|
|
|
|
|
{"remove_layer", (PyCFunction)UIGrid::py_remove_layer, METH_VARARGS,
|
|
|
|
|
"remove_layer(layer: ColorLayer | TileLayer) -> None"},
|
|
|
|
|
{"layer", (PyCFunction)UIGrid::py_layer, METH_VARARGS,
|
|
|
|
|
"layer(z_index: int) -> ColorLayer | TileLayer | None"},
|
2025-12-28 00:44:07 -05:00
|
|
|
{"entities_in_radius", (PyCFunction)UIGrid::py_entities_in_radius, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"entities_in_radius(x: float, y: float, radius: float) -> list[Entity]\n\n"
|
|
|
|
|
"Query entities within radius using spatial hash (O(k) where k = nearby entities).\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" x: Center X coordinate\n"
|
|
|
|
|
" y: Center Y coordinate\n"
|
|
|
|
|
" radius: Search radius\n\n"
|
|
|
|
|
"Returns:\n"
|
|
|
|
|
" List of Entity objects within the radius."},
|
feat: Grid camera defaults to tile (0,0) at top-left + center_camera() method (#169)
Changes:
- Default Grid center now positions tile (0,0) at widget's top-left corner
- Added center_camera() method to center grid's middle tile at view center
- Added center_camera((tile_x, tile_y)) to position tile at top-left of widget
- Uses NaN as sentinel to detect if user provided center values in kwargs
- Animation-compatible: center_camera() just sets center property, no special state
Behavior:
- center_camera() → grid's center tile at view center
- center_camera((0, 0)) → tile (0,0) at top-left corner
- center_camera((5, 10)) → tile (5,10) at top-left corner
Before: Grid(size=(320,240)) showed 3/4 of content off-screen (center=0,0)
After: Grid(size=(320,240)) shows tile (0,0) at top-left (center=160,120)
Closes #169
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:30:51 -05:00
|
|
|
{"center_camera", (PyCFunction)UIGrid::py_center_camera, METH_VARARGS,
|
|
|
|
|
"center_camera(pos: tuple = None) -> None\n\n"
|
|
|
|
|
"Center the camera on a tile coordinate.\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" pos: Optional (tile_x, tile_y) tuple. If None, centers on grid's middle tile.\n\n"
|
|
|
|
|
"Example:\n"
|
|
|
|
|
" grid.center_camera() # Center on middle of grid\n"
|
|
|
|
|
" grid.center_camera((5, 10)) # Center on tile (5, 10)\n"
|
|
|
|
|
" grid.center_camera((0, 0)) # Center on tile (0, 0)"},
|
2026-01-11 20:42:47 -05:00
|
|
|
// #199 - HeightMap application methods
|
|
|
|
|
{"apply_threshold", (PyCFunction)UIGrid::py_apply_threshold, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"apply_threshold(source: HeightMap, range: tuple, walkable: bool = None, transparent: bool = None) -> Grid\n\n"
|
|
|
|
|
"Apply walkable/transparent properties where heightmap values are in range.\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" source: HeightMap with values to check. Must match grid size.\n"
|
|
|
|
|
" range: Tuple of (min, max) - cells with values in this range are affected.\n"
|
|
|
|
|
" walkable: If not None, set walkable to this value for cells in range.\n"
|
|
|
|
|
" transparent: If not None, set transparent to this value for cells in range.\n\n"
|
|
|
|
|
"Returns:\n"
|
|
|
|
|
" Grid: self, for method chaining.\n\n"
|
|
|
|
|
"Raises:\n"
|
|
|
|
|
" ValueError: If HeightMap size doesn't match grid size."},
|
|
|
|
|
{"apply_ranges", (PyCFunction)UIGrid::py_apply_ranges, METH_VARARGS,
|
|
|
|
|
"apply_ranges(source: HeightMap, ranges: list) -> Grid\n\n"
|
|
|
|
|
"Apply multiple thresholds in a single pass.\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" source: HeightMap with values to check. Must match grid size.\n"
|
|
|
|
|
" ranges: List of (range_tuple, properties_dict) tuples.\n"
|
|
|
|
|
" range_tuple: (min, max) value range\n"
|
|
|
|
|
" properties_dict: {'walkable': bool, 'transparent': bool}\n\n"
|
|
|
|
|
"Returns:\n"
|
|
|
|
|
" Grid: self, for method chaining.\n\n"
|
|
|
|
|
"Example:\n"
|
|
|
|
|
" grid.apply_ranges(terrain, [\n"
|
|
|
|
|
" ((0.0, 0.3), {'walkable': False, 'transparent': True}), # Water\n"
|
|
|
|
|
" ((0.3, 0.8), {'walkable': True, 'transparent': True}), # Land\n"
|
|
|
|
|
" ((0.8, 1.0), {'walkable': False, 'transparent': False}), # Mountains\n"
|
|
|
|
|
" ])"},
|
2024-04-20 10:32:04 -04:00
|
|
|
{NULL, NULL, 0, NULL}
|
|
|
|
|
};
|
|
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
// Define the PyObjectType alias for the macros
|
|
|
|
|
typedef PyUIGridObject PyObjectType;
|
|
|
|
|
|
|
|
|
|
// Combined methods array
|
|
|
|
|
PyMethodDef UIGrid_all_methods[] = {
|
|
|
|
|
UIDRAWABLE_METHODS,
|
|
|
|
|
{"at", (PyCFunction)UIGrid::py_at, METH_VARARGS | METH_KEYWORDS},
|
2025-11-28 21:35:38 -05:00
|
|
|
{"compute_fov", (PyCFunction)UIGrid::py_compute_fov, METH_VARARGS | METH_KEYWORDS,
|
2026-01-05 10:16:16 -05:00
|
|
|
"compute_fov(pos, radius: int = 0, light_walls: bool = True, algorithm: int = FOV_BASIC) -> None\n\n"
|
2025-11-28 21:35:38 -05:00
|
|
|
"Compute field of view from a position.\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Args:\n"
|
2026-01-05 10:16:16 -05:00
|
|
|
" pos: Position as (x, y) tuple, list, or Vector\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
" radius: Maximum view distance (0 = unlimited)\n"
|
|
|
|
|
" light_walls: Whether walls are lit when visible\n"
|
|
|
|
|
" algorithm: FOV algorithm to use (FOV_BASIC, FOV_DIAMOND, FOV_SHADOW, FOV_PERMISSIVE_0-8)\n\n"
|
2026-01-05 10:16:16 -05:00
|
|
|
"Updates the internal FOV state. Use is_in_fov(pos) to query visibility."},
|
|
|
|
|
{"is_in_fov", (PyCFunction)UIGrid::py_is_in_fov, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"is_in_fov(pos) -> bool\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Check if a cell is in the field of view.\n\n"
|
|
|
|
|
"Args:\n"
|
2026-01-05 10:16:16 -05:00
|
|
|
" pos: Position as (x, y) tuple, list, or Vector\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Returns:\n"
|
|
|
|
|
" True if the cell is visible, False otherwise\n\n"
|
|
|
|
|
"Must call compute_fov() first to calculate visibility."},
|
2026-01-10 22:09:45 -05:00
|
|
|
{"find_path", (PyCFunction)UIGridPathfinding::Grid_find_path, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"find_path(start, end, diagonal_cost: float = 1.41) -> AStarPath | None\n\n"
|
|
|
|
|
"Compute A* path between two points.\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Args:\n"
|
2026-01-10 22:09:45 -05:00
|
|
|
" start: Starting position as Vector, Entity, or (x, y) tuple\n"
|
|
|
|
|
" end: Target position as Vector, Entity, or (x, y) tuple\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
" diagonal_cost: Cost of diagonal movement (default: 1.41)\n\n"
|
|
|
|
|
"Returns:\n"
|
2026-01-10 22:09:45 -05:00
|
|
|
" AStarPath object if path exists, None otherwise.\n\n"
|
|
|
|
|
"The returned AStarPath can be iterated or walked step-by-step."},
|
|
|
|
|
{"get_dijkstra_map", (PyCFunction)UIGridPathfinding::Grid_get_dijkstra_map, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"get_dijkstra_map(root, diagonal_cost: float = 1.41) -> DijkstraMap\n\n"
|
|
|
|
|
"Get or create a Dijkstra distance map for a root position.\n\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
"Args:\n"
|
2026-01-10 22:09:45 -05:00
|
|
|
" root: Root position as Vector, Entity, or (x, y) tuple\n"
|
2025-07-10 16:34:38 -04:00
|
|
|
" diagonal_cost: Cost of diagonal movement (default: 1.41)\n\n"
|
|
|
|
|
"Returns:\n"
|
2026-01-10 22:09:45 -05:00
|
|
|
" DijkstraMap object for querying distances and paths.\n\n"
|
|
|
|
|
"Grid caches DijkstraMaps by root position. Multiple requests for the\n"
|
|
|
|
|
"same root return the same cached map. Call clear_dijkstra_maps() after\n"
|
|
|
|
|
"changing grid walkability to invalidate the cache."},
|
|
|
|
|
{"clear_dijkstra_maps", (PyCFunction)UIGridPathfinding::Grid_clear_dijkstra_maps, METH_NOARGS,
|
|
|
|
|
"clear_dijkstra_maps() -> None\n\n"
|
|
|
|
|
"Clear all cached Dijkstra maps.\n\n"
|
|
|
|
|
"Call this after modifying grid cell walkability to ensure pathfinding\n"
|
|
|
|
|
"uses updated walkability data."},
|
2025-11-28 21:35:38 -05:00
|
|
|
{"add_layer", (PyCFunction)UIGrid::py_add_layer, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"add_layer(type: str, z_index: int = -1, texture: Texture = None) -> ColorLayer | TileLayer\n\n"
|
|
|
|
|
"Add a new layer to the grid.\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" type: Layer type ('color' or 'tile')\n"
|
|
|
|
|
" z_index: Render order. Negative = below entities, >= 0 = above entities. Default: -1\n"
|
|
|
|
|
" texture: Texture for tile layers. Required for 'tile' type.\n\n"
|
|
|
|
|
"Returns:\n"
|
|
|
|
|
" The created ColorLayer or TileLayer object."},
|
|
|
|
|
{"remove_layer", (PyCFunction)UIGrid::py_remove_layer, METH_VARARGS,
|
|
|
|
|
"remove_layer(layer: ColorLayer | TileLayer) -> None\n\n"
|
|
|
|
|
"Remove a layer from the grid.\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" layer: The layer to remove."},
|
|
|
|
|
{"layer", (PyCFunction)UIGrid::py_layer, METH_VARARGS,
|
|
|
|
|
"layer(z_index: int) -> ColorLayer | TileLayer | None\n\n"
|
|
|
|
|
"Get a layer by its z_index.\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" z_index: The z_index of the layer to find.\n\n"
|
|
|
|
|
"Returns:\n"
|
|
|
|
|
" The layer with the specified z_index, or None if not found."},
|
2025-12-28 00:44:07 -05:00
|
|
|
{"entities_in_radius", (PyCFunction)UIGrid::py_entities_in_radius, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"entities_in_radius(x: float, y: float, radius: float) -> list[Entity]\n\n"
|
|
|
|
|
"Query entities within radius using spatial hash (O(k) where k = nearby entities).\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" x: Center X coordinate\n"
|
|
|
|
|
" y: Center Y coordinate\n"
|
|
|
|
|
" radius: Search radius\n\n"
|
|
|
|
|
"Returns:\n"
|
|
|
|
|
" List of Entity objects within the radius."},
|
feat: Grid camera defaults to tile (0,0) at top-left + center_camera() method (#169)
Changes:
- Default Grid center now positions tile (0,0) at widget's top-left corner
- Added center_camera() method to center grid's middle tile at view center
- Added center_camera((tile_x, tile_y)) to position tile at top-left of widget
- Uses NaN as sentinel to detect if user provided center values in kwargs
- Animation-compatible: center_camera() just sets center property, no special state
Behavior:
- center_camera() → grid's center tile at view center
- center_camera((0, 0)) → tile (0,0) at top-left corner
- center_camera((5, 10)) → tile (5,10) at top-left corner
Before: Grid(size=(320,240)) showed 3/4 of content off-screen (center=0,0)
After: Grid(size=(320,240)) shows tile (0,0) at top-left (center=160,120)
Closes #169
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 16:30:51 -05:00
|
|
|
{"center_camera", (PyCFunction)UIGrid::py_center_camera, METH_VARARGS,
|
|
|
|
|
"center_camera(pos: tuple = None) -> None\n\n"
|
|
|
|
|
"Center the camera on a tile coordinate.\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" pos: Optional (tile_x, tile_y) tuple. If None, centers on grid's middle tile.\n\n"
|
|
|
|
|
"Example:\n"
|
|
|
|
|
" grid.center_camera() # Center on middle of grid\n"
|
|
|
|
|
" grid.center_camera((5, 10)) # Center on tile (5, 10)\n"
|
|
|
|
|
" grid.center_camera((0, 0)) # Center on tile (0, 0)"},
|
2026-01-11 20:42:47 -05:00
|
|
|
// #199 - HeightMap application methods
|
|
|
|
|
{"apply_threshold", (PyCFunction)UIGrid::py_apply_threshold, METH_VARARGS | METH_KEYWORDS,
|
|
|
|
|
"apply_threshold(source: HeightMap, range: tuple, walkable: bool = None, transparent: bool = None) -> Grid\n\n"
|
|
|
|
|
"Apply walkable/transparent properties where heightmap values are in range.\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" source: HeightMap with values to check. Must match grid size.\n"
|
|
|
|
|
" range: Tuple of (min, max) - cells with values in this range are affected.\n"
|
|
|
|
|
" walkable: If not None, set walkable to this value for cells in range.\n"
|
|
|
|
|
" transparent: If not None, set transparent to this value for cells in range.\n\n"
|
|
|
|
|
"Returns:\n"
|
|
|
|
|
" Grid: self, for method chaining.\n\n"
|
|
|
|
|
"Raises:\n"
|
|
|
|
|
" ValueError: If HeightMap size doesn't match grid size."},
|
|
|
|
|
{"apply_ranges", (PyCFunction)UIGrid::py_apply_ranges, METH_VARARGS,
|
|
|
|
|
"apply_ranges(source: HeightMap, ranges: list) -> Grid\n\n"
|
|
|
|
|
"Apply multiple thresholds in a single pass.\n\n"
|
|
|
|
|
"Args:\n"
|
|
|
|
|
" source: HeightMap with values to check. Must match grid size.\n"
|
|
|
|
|
" ranges: List of (range_tuple, properties_dict) tuples.\n"
|
|
|
|
|
" range_tuple: (min, max) value range\n"
|
|
|
|
|
" properties_dict: {'walkable': bool, 'transparent': bool}\n\n"
|
|
|
|
|
"Returns:\n"
|
|
|
|
|
" Grid: self, for method chaining.\n\n"
|
|
|
|
|
"Example:\n"
|
|
|
|
|
" grid.apply_ranges(terrain, [\n"
|
|
|
|
|
" ((0.0, 0.3), {'walkable': False, 'transparent': True}), # Water\n"
|
|
|
|
|
" ((0.3, 0.8), {'walkable': True, 'transparent': True}), # Land\n"
|
|
|
|
|
" ((0.8, 1.0), {'walkable': False, 'transparent': False}), # Mountains\n"
|
|
|
|
|
" ])"},
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
{NULL} // Sentinel
|
|
|
|
|
};
|
2024-04-20 10:32:04 -04:00
|
|
|
|
|
|
|
|
PyGetSetDef UIGrid::getsetters[] = {
|
|
|
|
|
|
|
|
|
|
// TODO - refactor into get_vector_member with field identifier values `(void*)n`
|
2026-01-06 10:21:50 -05:00
|
|
|
{"grid_size", (getter)UIGrid::get_grid_size, NULL, "Grid dimensions (grid_w, grid_h)", NULL},
|
|
|
|
|
{"grid_w", (getter)UIGrid::get_grid_w, NULL, "Grid width in cells", NULL},
|
|
|
|
|
{"grid_h", (getter)UIGrid::get_grid_h, NULL, "Grid height in cells", NULL},
|
2024-04-20 10:32:04 -04:00
|
|
|
{"position", (getter)UIGrid::get_position, (setter)UIGrid::set_position, "Position of the grid (x, y)", NULL},
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
{"pos", (getter)UIDrawable::get_pos, (setter)UIDrawable::set_pos, "Position of the grid as Vector", (void*)PyObjectsEnum::UIGRID},
|
2026-01-06 10:21:50 -05:00
|
|
|
{"size", (getter)UIGrid::get_size, (setter)UIGrid::set_size, "Size of the grid as Vector (width, height)", NULL},
|
2024-04-20 10:32:04 -04:00
|
|
|
{"center", (getter)UIGrid::get_center, (setter)UIGrid::set_center, "Grid coordinate at the center of the Grid's view (pan)", NULL},
|
|
|
|
|
|
2025-11-25 21:52:37 -05:00
|
|
|
{"entities", (getter)UIGrid::get_entities, NULL, "EntityCollection of entities on this grid", NULL},
|
|
|
|
|
{"children", (getter)UIGrid::get_children, NULL, "UICollection of UIDrawable children (speech bubbles, effects, overlays)", NULL},
|
2025-11-28 21:35:38 -05:00
|
|
|
{"layers", (getter)UIGrid::get_layers, NULL, "List of grid layers (ColorLayer, TileLayer) sorted by z_index", NULL},
|
2024-04-20 10:32:04 -04:00
|
|
|
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
{"x", (getter)UIDrawable::get_float_member, (setter)UIDrawable::set_float_member, "top-left corner X-coordinate", (void*)((intptr_t)PyObjectsEnum::UIGRID << 8 | 0)},
|
|
|
|
|
{"y", (getter)UIDrawable::get_float_member, (setter)UIDrawable::set_float_member, "top-left corner Y-coordinate", (void*)((intptr_t)PyObjectsEnum::UIGRID << 8 | 1)},
|
|
|
|
|
{"w", (getter)UIDrawable::get_float_member, (setter)UIDrawable::set_float_member, "visible widget width", (void*)((intptr_t)PyObjectsEnum::UIGRID << 8 | 2)},
|
|
|
|
|
{"h", (getter)UIDrawable::get_float_member, (setter)UIDrawable::set_float_member, "visible widget height", (void*)((intptr_t)PyObjectsEnum::UIGRID << 8 | 3)},
|
2024-04-20 10:32:04 -04:00
|
|
|
{"center_x", (getter)UIGrid::get_float_member, (setter)UIGrid::set_float_member, "center of the view X-coordinate", (void*)4},
|
|
|
|
|
{"center_y", (getter)UIGrid::get_float_member, (setter)UIGrid::set_float_member, "center of the view Y-coordinate", (void*)5},
|
|
|
|
|
{"zoom", (getter)UIGrid::get_float_member, (setter)UIGrid::set_float_member, "zoom factor for displaying the Grid", (void*)6},
|
|
|
|
|
|
2025-11-27 22:31:53 -05:00
|
|
|
{"on_click", (getter)UIDrawable::get_click, (setter)UIDrawable::set_click,
|
|
|
|
|
MCRF_PROPERTY(on_click,
|
2025-10-30 12:33:27 -04:00
|
|
|
"Callable executed when object is clicked. "
|
2026-01-05 10:16:16 -05:00
|
|
|
"Function receives (pos: Vector, button: str, action: str)."
|
2025-10-30 12:33:27 -04:00
|
|
|
), (void*)PyObjectsEnum::UIGRID},
|
2024-04-20 10:32:04 -04:00
|
|
|
|
|
|
|
|
{"texture", (getter)UIGrid::get_texture, NULL, "Texture of the grid", NULL}, //TODO 7DRL-day2-item5
|
2026-01-04 00:45:16 -05:00
|
|
|
{"fill_color", (getter)UIGrid::get_fill_color, (setter)UIGrid::set_fill_color,
|
|
|
|
|
"Background fill color of the grid. Returns a copy; modifying components requires reassignment. "
|
|
|
|
|
"For animation, use 'fill_color.r', 'fill_color.g', etc.", NULL},
|
2025-07-10 16:34:38 -04:00
|
|
|
{"perspective", (getter)UIGrid::get_perspective, (setter)UIGrid::set_perspective,
|
2025-07-21 23:47:21 -04:00
|
|
|
"Entity whose perspective to use for FOV rendering (None for omniscient view). "
|
|
|
|
|
"Setting an entity automatically enables perspective mode.", NULL},
|
|
|
|
|
{"perspective_enabled", (getter)UIGrid::get_perspective_enabled, (setter)UIGrid::set_perspective_enabled,
|
|
|
|
|
"Whether to use perspective-based FOV rendering. When True with no valid entity, "
|
|
|
|
|
"all cells appear undiscovered.", NULL},
|
feat: Implement FOV enum and layer draw_fov for #114 and #113
Phase 1 - FOV Enum System:
- Create PyFOV.h/cpp with mcrfpy.FOV IntEnum (BASIC, DIAMOND, SHADOW, etc.)
- Add mcrfpy.default_fov module property initialized to FOV.BASIC
- Add grid.fov and grid.fov_radius properties for per-grid defaults
- Remove deprecated module-level FOV_* constants (breaking change)
Phase 2 - Layer Operations:
- Implement ColorLayer.fill_rect(pos, size, color) for rectangle fills
- Implement TileLayer.fill_rect(pos, size, index) for tile rectangle fills
- Implement ColorLayer.draw_fov(source, radius, fov, visible, discovered, unknown)
to paint FOV-based visibility on color layers using parent grid's TCOD map
The FOV enum uses Python's IntEnum for type safety while maintaining
backward compatibility with integer values. Tests updated to use new API.
Addresses #114 (FOV enum), #113 (layer operations)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 15:18:10 -05:00
|
|
|
{"fov", (getter)UIGrid::get_fov, (setter)UIGrid::set_fov,
|
|
|
|
|
"FOV algorithm for this grid (mcrfpy.FOV enum). "
|
|
|
|
|
"Used by entity.updateVisibility() and layer methods when fov=None.", NULL},
|
|
|
|
|
{"fov_radius", (getter)UIGrid::get_fov_radius, (setter)UIGrid::set_fov_radius,
|
|
|
|
|
"Default FOV radius for this grid. Used when radius not specified.", NULL},
|
2025-10-30 12:33:27 -04:00
|
|
|
{"z_index", (getter)UIDrawable::get_int, (setter)UIDrawable::set_int,
|
|
|
|
|
MCRF_PROPERTY(z_index,
|
|
|
|
|
"Z-order for rendering (lower values rendered first). "
|
|
|
|
|
"Automatically triggers scene resort when changed."
|
|
|
|
|
), (void*)PyObjectsEnum::UIGRID},
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
{"name", (getter)UIDrawable::get_name, (setter)UIDrawable::set_name, "Name for finding elements", (void*)PyObjectsEnum::UIGRID},
|
|
|
|
|
UIDRAWABLE_GETSETTERS,
|
2025-11-27 16:33:17 -05:00
|
|
|
UIDRAWABLE_PARENT_GETSETTERS(PyObjectsEnum::UIGRID),
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
// #142 - Grid cell mouse events
|
|
|
|
|
{"on_cell_enter", (getter)UIGrid::get_on_cell_enter, (setter)UIGrid::set_on_cell_enter,
|
2026-01-05 10:16:16 -05:00
|
|
|
"Callback when mouse enters a grid cell. Called with (cell_pos: Vector).", NULL},
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
{"on_cell_exit", (getter)UIGrid::get_on_cell_exit, (setter)UIGrid::set_on_cell_exit,
|
2026-01-05 10:16:16 -05:00
|
|
|
"Callback when mouse exits a grid cell. Called with (cell_pos: Vector).", NULL},
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
{"on_cell_click", (getter)UIGrid::get_on_cell_click, (setter)UIGrid::set_on_cell_click,
|
2026-01-05 10:16:16 -05:00
|
|
|
"Callback when a grid cell is clicked. Called with (cell_pos: Vector).", NULL},
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
{"hovered_cell", (getter)UIGrid::get_hovered_cell, NULL,
|
|
|
|
|
"Currently hovered cell as (x, y) tuple, or None if not hovering.", NULL},
|
2024-04-20 10:32:04 -04:00
|
|
|
{NULL} /* Sentinel */
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-25 21:52:37 -05:00
|
|
|
PyObject* UIGrid::get_entities(PyUIGridObject* self, void* closure)
|
2024-04-20 10:32:04 -04:00
|
|
|
{
|
2025-11-25 21:52:37 -05:00
|
|
|
// Returns EntityCollection for entity management
|
2026-01-10 08:37:31 -05:00
|
|
|
// Use the type directly from namespace (type not exported to module)
|
|
|
|
|
PyTypeObject* type = &mcrfpydef::PyUIEntityCollectionType;
|
2024-04-20 10:32:04 -04:00
|
|
|
auto o = (PyUIEntityCollectionObject*)type->tp_alloc(type, 0);
|
|
|
|
|
if (o) {
|
2025-11-25 21:52:37 -05:00
|
|
|
o->data = self->data->entities;
|
2024-04-20 10:32:04 -04:00
|
|
|
o->grid = self->data;
|
|
|
|
|
}
|
|
|
|
|
return (PyObject*)o;
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-25 21:52:37 -05:00
|
|
|
PyObject* UIGrid::get_children(PyUIGridObject* self, void* closure)
|
|
|
|
|
{
|
|
|
|
|
// Returns UICollection for UIDrawable children (speech bubbles, effects, overlays)
|
2026-01-06 10:21:50 -05:00
|
|
|
// Use the type directly from namespace (#189 - type not exported to module)
|
|
|
|
|
PyTypeObject* type = &mcrfpydef::PyUICollectionType;
|
2025-11-25 21:52:37 -05:00
|
|
|
auto o = (PyUICollectionObject*)type->tp_alloc(type, 0);
|
|
|
|
|
if (o) {
|
|
|
|
|
o->data = self->data->children;
|
2025-11-27 16:33:17 -05:00
|
|
|
o->owner = self->data; // #122: Set owner for parent tracking
|
2025-11-25 21:52:37 -05:00
|
|
|
}
|
|
|
|
|
return (PyObject*)o;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 18:33:18 -04:00
|
|
|
PyObject* UIGrid::repr(PyUIGridObject* self)
|
|
|
|
|
{
|
|
|
|
|
std::ostringstream ss;
|
|
|
|
|
if (!self->data) ss << "<Grid (invalid internal object)>";
|
|
|
|
|
else {
|
|
|
|
|
auto grid = self->data;
|
|
|
|
|
auto box = grid->box;
|
|
|
|
|
ss << "<Grid (x=" << box.getPosition().x << ", y=" << box.getPosition().y << ", w=" << box.getSize().x << ", h=" << box.getSize().y << ", " <<
|
|
|
|
|
"center=(" << grid->center_x << ", " << grid->center_y << "), zoom=" << grid->zoom <<
|
|
|
|
|
")>";
|
|
|
|
|
}
|
|
|
|
|
std::string repr_str = ss.str();
|
|
|
|
|
return PyUnicode_DecodeUTF8(repr_str.c_str(), repr_str.size(), "replace");
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 10:32:04 -04:00
|
|
|
/* // TODO standard pointer would need deleted, but I opted for a shared pointer. tp_dealloc currently not even defined in the PyTypeObject
|
|
|
|
|
void PyUIGrid_dealloc(PyUIGridObject* self) {
|
|
|
|
|
delete self->data; // Clean up the allocated UIGrid object
|
|
|
|
|
Py_TYPE(self)->tp_free((PyObject*)self);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
// #142 - Grid cell mouse event getters/setters
|
|
|
|
|
PyObject* UIGrid::get_on_cell_enter(PyUIGridObject* self, void* closure) {
|
|
|
|
|
if (self->data->on_cell_enter_callable) {
|
|
|
|
|
PyObject* cb = self->data->on_cell_enter_callable->borrow();
|
|
|
|
|
Py_INCREF(cb); // Return new reference, not borrowed
|
|
|
|
|
return cb;
|
|
|
|
|
}
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_on_cell_enter(PyUIGridObject* self, PyObject* value, void* closure) {
|
|
|
|
|
if (value == Py_None) {
|
|
|
|
|
self->data->on_cell_enter_callable.reset();
|
|
|
|
|
} else {
|
|
|
|
|
self->data->on_cell_enter_callable = std::make_unique<PyClickCallable>(value);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::get_on_cell_exit(PyUIGridObject* self, void* closure) {
|
|
|
|
|
if (self->data->on_cell_exit_callable) {
|
|
|
|
|
PyObject* cb = self->data->on_cell_exit_callable->borrow();
|
|
|
|
|
Py_INCREF(cb); // Return new reference, not borrowed
|
|
|
|
|
return cb;
|
|
|
|
|
}
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_on_cell_exit(PyUIGridObject* self, PyObject* value, void* closure) {
|
|
|
|
|
if (value == Py_None) {
|
|
|
|
|
self->data->on_cell_exit_callable.reset();
|
|
|
|
|
} else {
|
|
|
|
|
self->data->on_cell_exit_callable = std::make_unique<PyClickCallable>(value);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::get_on_cell_click(PyUIGridObject* self, void* closure) {
|
|
|
|
|
if (self->data->on_cell_click_callable) {
|
|
|
|
|
PyObject* cb = self->data->on_cell_click_callable->borrow();
|
|
|
|
|
Py_INCREF(cb); // Return new reference, not borrowed
|
|
|
|
|
return cb;
|
|
|
|
|
}
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int UIGrid::set_on_cell_click(PyUIGridObject* self, PyObject* value, void* closure) {
|
|
|
|
|
if (value == Py_None) {
|
|
|
|
|
self->data->on_cell_click_callable.reset();
|
|
|
|
|
} else {
|
|
|
|
|
self->data->on_cell_click_callable = std::make_unique<PyClickCallable>(value);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PyObject* UIGrid::get_hovered_cell(PyUIGridObject* self, void* closure) {
|
|
|
|
|
if (self->data->hovered_cell.has_value()) {
|
|
|
|
|
return Py_BuildValue("(ii)", self->data->hovered_cell->x, self->data->hovered_cell->y);
|
|
|
|
|
}
|
|
|
|
|
Py_RETURN_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// #142 - Convert screen coordinates to cell coordinates
|
|
|
|
|
std::optional<sf::Vector2i> UIGrid::screenToCell(sf::Vector2f screen_pos) const {
|
|
|
|
|
// Get grid's global position
|
|
|
|
|
sf::Vector2f global_pos = get_global_position();
|
|
|
|
|
sf::Vector2f local_pos = screen_pos - global_pos;
|
|
|
|
|
|
|
|
|
|
// Check if within grid bounds
|
|
|
|
|
sf::FloatRect bounds = box.getGlobalBounds();
|
|
|
|
|
if (local_pos.x < 0 || local_pos.y < 0 ||
|
|
|
|
|
local_pos.x >= bounds.width || local_pos.y >= bounds.height) {
|
|
|
|
|
return std::nullopt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get cell size from texture or default
|
|
|
|
|
float cell_width = ptex ? ptex->sprite_width : DEFAULT_CELL_WIDTH;
|
|
|
|
|
float cell_height = ptex ? ptex->sprite_height : DEFAULT_CELL_HEIGHT;
|
|
|
|
|
|
|
|
|
|
// Apply zoom
|
|
|
|
|
cell_width *= zoom;
|
|
|
|
|
cell_height *= zoom;
|
|
|
|
|
|
|
|
|
|
// Calculate grid space position (account for center/pan)
|
|
|
|
|
float half_width = bounds.width / 2.0f;
|
|
|
|
|
float half_height = bounds.height / 2.0f;
|
|
|
|
|
float grid_space_x = (local_pos.x - half_width) / zoom + center_x;
|
|
|
|
|
float grid_space_y = (local_pos.y - half_height) / zoom + center_y;
|
|
|
|
|
|
|
|
|
|
// Convert to cell coordinates
|
|
|
|
|
int cell_x = static_cast<int>(std::floor(grid_space_x / (ptex ? ptex->sprite_width : DEFAULT_CELL_WIDTH)));
|
|
|
|
|
int cell_y = static_cast<int>(std::floor(grid_space_y / (ptex ? ptex->sprite_height : DEFAULT_CELL_HEIGHT)));
|
|
|
|
|
|
|
|
|
|
// Check if within valid cell range
|
2026-01-06 10:21:50 -05:00
|
|
|
if (cell_x < 0 || cell_x >= grid_w || cell_y < 0 || cell_y >= grid_h) {
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
return std::nullopt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sf::Vector2i(cell_x, cell_y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// #142 - Update cell hover state and fire callbacks
|
|
|
|
|
void UIGrid::updateCellHover(sf::Vector2f mousepos) {
|
|
|
|
|
auto new_cell = screenToCell(mousepos);
|
|
|
|
|
|
|
|
|
|
// Check if cell changed
|
|
|
|
|
if (new_cell != hovered_cell) {
|
|
|
|
|
// Fire exit callback for old cell
|
|
|
|
|
if (hovered_cell.has_value() && on_cell_exit_callable) {
|
2026-01-05 10:31:41 -05:00
|
|
|
// Create Vector object for cell position - must fetch finalized type from module
|
|
|
|
|
PyObject* vector_type = PyObject_GetAttrString(McRFPy_API::mcrf_module, "Vector");
|
|
|
|
|
if (vector_type) {
|
|
|
|
|
PyObject* cell_pos = PyObject_CallFunction(vector_type, "ff", (float)hovered_cell->x, (float)hovered_cell->y);
|
|
|
|
|
Py_DECREF(vector_type);
|
|
|
|
|
if (cell_pos) {
|
|
|
|
|
PyObject* args = Py_BuildValue("(O)", cell_pos);
|
|
|
|
|
Py_DECREF(cell_pos);
|
|
|
|
|
PyObject* result = PyObject_CallObject(on_cell_exit_callable->borrow(), args);
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
if (!result) {
|
|
|
|
|
std::cerr << "Cell exit callback raised an exception:" << std::endl;
|
|
|
|
|
PyErr_Print();
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
} else {
|
|
|
|
|
Py_DECREF(result);
|
|
|
|
|
}
|
2026-01-05 10:16:16 -05:00
|
|
|
}
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Fire enter callback for new cell
|
|
|
|
|
if (new_cell.has_value() && on_cell_enter_callable) {
|
2026-01-05 10:31:41 -05:00
|
|
|
// Create Vector object for cell position - must fetch finalized type from module
|
|
|
|
|
PyObject* vector_type = PyObject_GetAttrString(McRFPy_API::mcrf_module, "Vector");
|
|
|
|
|
if (vector_type) {
|
|
|
|
|
PyObject* cell_pos = PyObject_CallFunction(vector_type, "ff", (float)new_cell->x, (float)new_cell->y);
|
|
|
|
|
Py_DECREF(vector_type);
|
|
|
|
|
if (cell_pos) {
|
|
|
|
|
PyObject* args = Py_BuildValue("(O)", cell_pos);
|
|
|
|
|
Py_DECREF(cell_pos);
|
|
|
|
|
PyObject* result = PyObject_CallObject(on_cell_enter_callable->borrow(), args);
|
|
|
|
|
Py_DECREF(args);
|
|
|
|
|
if (!result) {
|
|
|
|
|
std::cerr << "Cell enter callback raised an exception:" << std::endl;
|
|
|
|
|
PyErr_Print();
|
|
|
|
|
PyErr_Clear();
|
|
|
|
|
} else {
|
|
|
|
|
Py_DECREF(result);
|
|
|
|
|
}
|
2026-01-05 10:16:16 -05:00
|
|
|
}
|
feat: Implement comprehensive mouse event system
Implements multiple mouse event improvements for UI elements:
- Mouse enter/exit events (#140): on_enter, on_exit callbacks and
hovered property for all UIDrawable types (Frame, Caption, Sprite, Grid)
- Headless click events (#111): Track simulated mouse position for
automation testing in headless mode
- Mouse move events (#141): on_move callback fires continuously while
mouse is within element bounds
- Grid cell events (#142): on_cell_enter, on_cell_exit, on_cell_click
callbacks with cell coordinates (x, y), plus hovered_cell property
Includes comprehensive tests for all new functionality.
Closes #140, closes #111, closes #141, closes #142
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 23:08:31 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hovered_cell = new_cell;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-10 08:37:31 -05:00
|
|
|
// UIEntityCollection code has been moved to UIEntityCollection.cpp
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
|
|
|
|
|
// Property system implementation for animations
|
|
|
|
|
bool UIGrid::setProperty(const std::string& name, float value) {
|
|
|
|
|
if (name == "x") {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
position.x = value;
|
|
|
|
|
box.setPosition(position);
|
|
|
|
|
output.setPosition(position);
|
2025-11-28 19:30:24 -05:00
|
|
|
markCompositeDirty(); // #144 - Position change, texture still valid
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "y") {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
position.y = value;
|
|
|
|
|
box.setPosition(position);
|
|
|
|
|
output.setPosition(position);
|
2025-11-28 19:30:24 -05:00
|
|
|
markCompositeDirty(); // #144 - Position change, texture still valid
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "w" || name == "width") {
|
|
|
|
|
box.setSize(sf::Vector2f(value, box.getSize().y));
|
|
|
|
|
output.setTextureRect(sf::IntRect(0, 0, box.getSize().x, box.getSize().y));
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - Size change
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "h" || name == "height") {
|
|
|
|
|
box.setSize(sf::Vector2f(box.getSize().x, value));
|
|
|
|
|
output.setTextureRect(sf::IntRect(0, 0, box.getSize().x, box.getSize().y));
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - Size change
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "center_x") {
|
|
|
|
|
center_x = value;
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - View change affects content
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "center_y") {
|
|
|
|
|
center_y = value;
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - View change affects content
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "zoom") {
|
|
|
|
|
zoom = value;
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - View change affects content
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "z_index") {
|
|
|
|
|
z_index = static_cast<int>(value);
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - Z-order change affects parent
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
else if (name == "fill_color.r") {
|
|
|
|
|
fill_color.r = static_cast<uint8_t>(std::max(0.0f, std::min(255.0f, value)));
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - Content change
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "fill_color.g") {
|
|
|
|
|
fill_color.g = static_cast<uint8_t>(std::max(0.0f, std::min(255.0f, value)));
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - Content change
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "fill_color.b") {
|
|
|
|
|
fill_color.b = static_cast<uint8_t>(std::max(0.0f, std::min(255.0f, value)));
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - Content change
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "fill_color.a") {
|
|
|
|
|
fill_color.a = static_cast<uint8_t>(std::max(0.0f, std::min(255.0f, value)));
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - Content change
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UIGrid::setProperty(const std::string& name, const sf::Vector2f& value) {
|
|
|
|
|
if (name == "position") {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
position = value;
|
|
|
|
|
box.setPosition(position);
|
|
|
|
|
output.setPosition(position);
|
2025-11-28 19:30:24 -05:00
|
|
|
markCompositeDirty(); // #144 - Position change, texture still valid
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "size") {
|
|
|
|
|
box.setSize(value);
|
|
|
|
|
output.setTextureRect(sf::IntRect(0, 0, box.getSize().x, box.getSize().y));
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - Size change
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "center") {
|
|
|
|
|
center_x = value.x;
|
|
|
|
|
center_y = value.y;
|
feat: Add dirty flag propagation to all UIDrawables and expand metrics API (#144, #104)
- Add markDirty() calls to setProperty() methods in:
- UISprite: position, scale, sprite_index changes
- UICaption: position, font_size, colors, text changes
- UIGrid: position, size, center, zoom, color changes
- UILine: thickness, position, endpoints, color changes
- UICircle: radius, position, colors changes
- UIArc: radius, angles, position, color changes
- UIEntity: position changes propagate to parent grid
- Expand getMetrics() Python API to include detailed timing breakdown:
- grid_render_time, entity_render_time, fov_overlay_time
- python_time, animation_time
- grid_cells_rendered, entities_rendered, total_entities
- Add comprehensive benchmark suite (tests/benchmarks/benchmark_suite.py):
- 6 scenarios: empty, static UI, animated UI, mixed, deep hierarchy, grid stress
- Automated metrics collection and performance assessment
- Timing breakdown percentages
This enables proper dirty flag propagation for the upcoming texture caching
system (#144) and provides infrastructure for performance benchmarking (#104).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-28 15:44:09 -05:00
|
|
|
markDirty(); // #144 - View change affects content
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UIGrid::getProperty(const std::string& name, float& value) const {
|
|
|
|
|
if (name == "x") {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
value = position.x;
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "y") {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
value = position.y;
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "w" || name == "width") {
|
|
|
|
|
value = box.getSize().x;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "h" || name == "height") {
|
|
|
|
|
value = box.getSize().y;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "center_x") {
|
|
|
|
|
value = center_x;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "center_y") {
|
|
|
|
|
value = center_y;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "zoom") {
|
|
|
|
|
value = zoom;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "z_index") {
|
|
|
|
|
value = static_cast<float>(z_index);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
else if (name == "fill_color.r") {
|
|
|
|
|
value = static_cast<float>(fill_color.r);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "fill_color.g") {
|
|
|
|
|
value = static_cast<float>(fill_color.g);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "fill_color.b") {
|
|
|
|
|
value = static_cast<float>(fill_color.b);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "fill_color.a") {
|
|
|
|
|
value = static_cast<float>(fill_color.a);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool UIGrid::getProperty(const std::string& name, sf::Vector2f& value) const {
|
|
|
|
|
if (name == "position") {
|
Squashed commit of 53 Commits: [alpha_streamline_2]
* Field of View, Pathing courtesy of libtcod
* python-tcod emulation at `mcrfpy.libtcod` - partial implementation
* documentation, tutorial drafts: in middling to good shape
┌────────────┬────────────────────┬───────────┬────────────┬───────────────┬────────────────┬────────────────┬─────────────┐
│ Date │ Models │ Input │ Output │ Cache Create │ Cache Read │ Total Tokens │ Cost (USD) │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-05 │ - opus-4 │ 13,630 │ 159,500 │ 3,854,900 │ 84,185,034 │ 88,213,064 │ $210.72 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-06 │ - opus-4 │ 5,814 │ 113,190 │ 4,242,407 │ 150,191,183 │ 154,552,594 │ $313.41 │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-07 │ - opus-4 │ 7,244 │ 104,599 │ 3,894,453 │ 81,781,179 │ 85,787,475 │ $184.46 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-08 │ - opus-4 │ 50,312 │ 158,599 │ 5,021,189 │ 60,028,561 │ 65,258,661 │ $167.05 │
│ │ - sonnet-4 │ │ │ │ │ │ │
├────────────┼────────────────────┼───────────┼────────────┼───────────────┼────────────────┼────────────────┼─────────────┤
│ 2025-07-09 │ - opus-4 │ 6,311 │ 109,653 │ 4,171,140 │ 80,092,875 │ 84,379,979 │ $193.09 │
│ │ - sonnet-4 │ │ │ │ │ │ │
└────────────┴────────────────────┴───────────┴────────────┴───────────────┴────────────────┴────────────────┴─────────────┘
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
Author: John McCardle <mccardle.john@gmail.com>
Draft tutorials
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with FOV, A* pathfinding, and GUI text widget completions
- Mark TCOD Integration Sprint as complete
- Document FOV system with perspective rendering implementation
- Update UIEntity pathfinding status to complete with A* and caching
- Add comprehensive achievement entry for July 10 work
- Reflect current engine capabilities accurately
The engine now has all core roguelike mechanics:
- Field of View with per-entity visibility
- Pathfinding (both Dijkstra and A*)
- Text input for in-game consoles
- Performance optimizations throughout
Author: John McCardle <mccardle.john@gmail.com>
feat(engine): implement perspective FOV, pathfinding, and GUI text widgets
Major Engine Enhancements:
- Complete FOV (Field of View) system with perspective rendering
- UIGrid.perspective property for entity-based visibility
- Three-layer overlay colors (unexplored, explored, visible)
- Per-entity visibility state tracking
- Perfect knowledge updates only for explored areas
- Advanced Pathfinding Integration
- A* pathfinding implementation in UIGrid
- Entity.path_to() method for direct pathfinding
- Dijkstra maps for multi-target pathfinding
- Path caching for performance optimization
- GUI Text Input Widgets
- TextInputWidget class with cursor, selection, scrolling
- Improved widget with proper text rendering and input handling
- Example showcase of multiple text input fields
- Foundation for in-game console and chat systems
- Performance & Architecture Improvements
- PyTexture copy operations optimized
- GameEngine update cycle refined
- UIEntity property handling enhanced
- UITestScene modernized
Test Suite:
- Interactive visibility demos showing FOV in action
- Pathfinding comparison (A* vs Dijkstra)
- Debug utilities for visibility and empty path handling
- Sizzle reel demo combining pathfinding and vision
- Multiple text input test scenarios
This commit brings McRogueFace closer to a complete roguelike engine
with essential features like line-of-sight, intelligent pathfinding,
and interactive text input capabilities.
Author: John McCardle <mccardle.john@gmail.com>
feat(demos): enhance interactive pathfinding demos with entity.path_to()
- dijkstra_interactive_enhanced.py: Animation along paths with smooth movement
- M key to start movement animation
- P to pause/resume
- R to reset positions
- Visual path gradient for better clarity
- pathfinding_showcase.py: Advanced multi-entity behaviors
- Chase mode: enemies pursue player
- Flee mode: enemies avoid player
- Patrol mode: entities follow waypoints
- WASD player movement
- Dijkstra distance field visualization (D key)
- Larger dungeon map with multiple rooms
- Both demos use new entity.path_to() method
- Smooth interpolated movement animations
- Real-time pathfinding recalculation
- Comprehensive test coverage
These demos showcase the power of integrated pathfinding for game AI.
Author: John McCardle <mccardle.john@gmail.com>
feat(entity): implement path_to() method for entity pathfinding
- Add path_to(target_x, target_y) method to UIEntity class
- Uses existing Dijkstra pathfinding implementation from UIGrid
- Returns list of (x, y) coordinate tuples for complete path
- Supports both positional and keyword argument formats
- Proper error handling for out-of-bounds and no-grid scenarios
- Comprehensive test suite covering normal and edge cases
Part of TCOD integration sprint - gives entities immediate pathfinding capabilities.
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap with Dijkstra pathfinding progress
- Mark UIGrid TCOD Integration as completed
- Document critical PyArg bug fix achievement
- Update UIEntity Pathfinding to 50% complete
- Add detailed progress notes for July 9 sprint work
Author: John McCardle <mccardle.john@gmail.com>
feat(tcod): complete Dijkstra pathfinding implementation with critical PyArg fix
- Add complete Dijkstra pathfinding to UIGrid class
- compute_dijkstra(), get_dijkstra_distance(), get_dijkstra_path()
- Full TCODMap and TCODDijkstra integration
- Proper memory management in constructors/destructors
- Create mcrfpy.libtcod submodule with Python bindings
- dijkstra_compute(), dijkstra_get_distance(), dijkstra_get_path()
- line() function for drawing corridors
- Foundation for future FOV and pathfinding algorithms
- Fix critical PyArg bug in UIGridPoint color setter
- PyObject_to_sfColor() now handles both Color objects and tuples
- Prevents "SystemError: new style getargs format but argument is not a tuple"
- Proper error handling and exception propagation
- Add comprehensive test suite
- test_dijkstra_simple.py validates all pathfinding operations
- dijkstra_test.py for headless testing with screenshots
- dijkstra_interactive.py for full user interaction demos
- Consolidate and clean up test files
- Removed 6 duplicate/broken demo attempts
- Two clean versions: headless test + interactive demo
Part of TCOD integration sprint for RoguelikeDev Tutorial Event.
Author: John McCardle <mccardle.john@gmail.com>
Roguelike Tutorial Planning + Prep
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete markdown API documentation export
- Created comprehensive markdown documentation matching HTML completeness
- Documented all 75 functions, 20 classes, 56 methods, and 20 automation methods
- Zero ellipsis instances - complete coverage with no missing documentation
- Added proper markdown formatting with code blocks and navigation
- Included full parameter documentation, return values, and examples
Key features:
- 23KB GitHub-compatible markdown documentation
- 47 argument sections with detailed parameters
- 35 return value specifications
- 23 code examples with syntax highlighting
- 38 explanatory notes and 10 exception specifications
- Full table of contents with anchor links
- Professional markdown formatting
Both export formats now available:
- HTML: docs/api_reference_complete.html (54KB, rich styling)
- Markdown: docs/API_REFERENCE_COMPLETE.md (23KB, GitHub-compatible)
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): complete API documentation with zero missing methods
- Eliminated ALL ellipsis instances (0 remaining)
- Documented 40 functions with complete signatures and examples
- Documented 21 classes with full method and property documentation
- Added 56 method descriptions with detailed parameters and return values
- Included 15 complete property specifications
- Added 24 code examples and 38 explanatory notes
- Comprehensive coverage of all collection methods, system classes, and functions
Key highlights:
- EntityCollection/UICollection: Complete method docs (append, remove, extend, count, index)
- Animation: Full property and method documentation with examples
- Color: All manipulation methods (from_hex, to_hex, lerp) with examples
- Vector: Complete mathematical operations (magnitude, normalize, dot, distance_to, angle, copy)
- Scene: All management methods including register_keyboard
- Timer: Complete control methods (pause, resume, cancel, restart)
- Window: All management methods (get, center, screenshot)
- System functions: Complete audio, scene, UI, and system function documentation
Author: John McCardle <mccardle.john@gmail.com>
feat(docs): create professional HTML API documentation
- Fixed all formatting issues from original HTML output
- Added comprehensive constructor documentation for all classes
- Enhanced visual design with modern styling and typography
- Fixed literal newline display and markdown link conversion
- Added proper semantic HTML structure and navigation
- Includes detailed documentation for Entity, collections, and system types
Author: John McCardle <mccardle.john@gmail.com>
feat: complete API reference generator and finish Phase 7 documentation
Implemented comprehensive API documentation generator that:
- Introspects live mcrfpy module for accurate documentation
- Generates organized Markdown reference (docs/API_REFERENCE.md)
- Categorizes classes and functions by type
- Includes full automation module documentation
- Provides summary statistics
Results:
- 20 classes documented
- 19 module functions documented
- 20 automation methods documented
- 100% coverage of public API
- Clean, readable Markdown output
Phase 7 Summary:
- Completed 4/5 tasks (1 cancelled as architecturally inappropriate)
- All documentation tasks successful
- Type stubs, docstrings, and API reference all complete
Author: John McCardle <mccardle.john@gmail.com>
docs: cancel PyPI wheel task and add future vision for Python extension architecture
Task #70 Analysis:
- Discovered fundamental incompatibility with PyPI distribution
- McRogueFace embeds CPython rather than being loaded by it
- Traditional wheels expect to extend existing Python interpreter
- Current architecture is application-with-embedded-Python
Decisions:
- Cancelled PyPI wheel preparation as out of scope for Alpha
- Cleaned up attempted packaging files (pyproject.toml, setup.py, etc.)
- Identified better distribution methods (installers, package managers)
Added Future Vision:
- Comprehensive plan for pure Python extension architecture
- Would allow true "pip install mcrogueface" experience
- Requires major refactoring to invert control flow
- Python would drive main loop with C++ performance extensions
- Unscheduled but documented as long-term possibility
This clarifies the architectural boundaries and sets realistic
expectations for distribution methods while preserving the vision
of what McRogueFace could become with significant rework.
Author: John McCardle <mccardle.john@gmail.com>
feat: generate comprehensive .pyi type stubs for IDE support (#108)
Created complete type stub files for the mcrfpy module to enable:
- Full IntelliSense/autocomplete in IDEs
- Static type checking with mypy/pyright
- Better documentation tooltips
- Parameter hints and return types
Implementation details:
- Manually crafted stubs for accuracy (15KB, 533 lines)
- Complete coverage: 19 classes, 112 functions/methods
- Proper type annotations using typing module
- @overload decorators for multiple signatures
- Type aliases for common patterns (UIElement union)
- Preserved all docstrings for IDE help
- Automation module fully typed
- PEP 561 compliant with py.typed marker
Testing:
- Validated Python syntax with ast.parse()
- Verified all expected classes and functions
- Confirmed type annotations are well-formed
- Checked docstring preservation (80 docstrings)
Usage:
- VS Code: Add stubs/ to python.analysis.extraPaths
- PyCharm: Mark stubs/ directory as Sources Root
- Other IDEs will auto-detect .pyi files
This significantly improves the developer experience when using
McRogueFace as a Python game engine.
Author: John McCardle <mccardle.john@gmail.com>
docs: add comprehensive parameter documentation to all API methods (#86)
Enhanced documentation for the mcrfpy module with:
- Detailed docstrings for all API methods
- Type hints in documentation (name: type format)
- Return type specifications
- Exception documentation where applicable
- Usage examples for complex methods
- Module-level documentation with overview and example code
Specific improvements:
- Audio API: Added parameter types and return values
- Scene API: Documented transition types and error conditions
- Timer API: Clarified handler signature and runtime parameter
- UI Search: Added wildcard pattern examples for findAll()
- Metrics API: Documented all dictionary keys returned
Also fixed method signatures:
- Changed METH_VARARGS to METH_NOARGS for parameterless methods
- Ensures proper Python calling conventions
Test coverage included - all documentation is accessible via Python's
__doc__ attributes and shows correctly formatted information.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark issue #85 as completed in Phase 7
Author: John McCardle <mccardle.john@gmail.com>
docs: replace all 'docstring' placeholders with comprehensive documentation (#85)
Added proper Python docstrings for all UI component classes:
UIFrame:
- Container element that can hold child drawables
- Documents position, size, colors, outline, and clip_children
- Includes constructor signature with all parameters
UICaption:
- Text display element with font and styling
- Documents text content, position, font, colors, outline
- Notes that w/h are computed from text content
UISprite:
- Texture/sprite display element
- Documents position, texture, sprite_index, scale
- Notes that w/h are computed from texture and scale
UIGrid:
- Tile-based grid for game worlds
- Documents grid dimensions, tile size, texture atlas
- Includes entities collection and background_color
All docstrings follow consistent format:
- Constructor signature with defaults
- Brief description
- Args section with types and defaults
- Attributes section with all properties
This completes Phase 7 task #85 for documentation improvements.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP with PyArgHelpers infrastructure completion
Author: John McCardle <mccardle.john@gmail.com>
refactor: implement PyArgHelpers for standardized Python argument parsing
This major refactoring standardizes how position, size, and other arguments
are parsed across all UI components. PyArgHelpers provides consistent handling
for various argument patterns:
- Position as (x, y) tuple or separate x, y args
- Size as (w, h) tuple or separate width, height args
- Grid position and size with proper validation
- Color parsing with PyColorObject support
Changes across UI components:
- UICaption: Migrated to PyArgHelpers, improved resize() for future multiline support
- UIFrame: Uses standardized position parsing
- UISprite: Consistent position handling
- UIGrid: Grid-specific position/size helpers
- UIEntity: Unified argument parsing
Also includes:
- Improved error messages for type mismatches (int or float accepted)
- Reduced code duplication across constructors
- Better handling of keyword/positional argument conflicts
- Maintains backward compatibility with existing API
This addresses the inconsistent argument handling patterns discovered during
the inheritance hierarchy work and prepares for Phase 7 documentation.
Author: John McCardle <mccardle.john@gmail.com>
feat(Python): establish proper inheritance hierarchy for UI types
All UIDrawable-derived Python types now properly inherit from the Drawable
base class in Python, matching the C++ inheritance structure.
Changes:
- Add Py_TPFLAGS_BASETYPE to PyDrawableType to allow inheritance
- Set tp_base = &mcrfpydef::PyDrawableType for all UI types
- Add PyDrawable.h include to UI type headers
- Rename _Drawable to Drawable and update error message
This enables proper Python inheritance: Frame, Caption, Sprite, Grid,
and Entity all inherit from Drawable, allowing shared functionality
and isinstance() checks.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UISprite)
- Update UISprite to use base class position instead of sprite position
- Synchronize sprite position with base class position for rendering
- Implement onPositionChanged() for position synchronization
- Update all UISprite methods to use base position consistently
- Add comprehensive test coverage for UISprite position handling
This is part 3 of moving position to the base class. UIGrid is the final
class that needs to be updated.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UICaption)
- Update UICaption to use base class position instead of text position
- Synchronize text position with base class position for rendering
- Add onPositionChanged() virtual method for position synchronization
- Update all UICaption methods to use base position consistently
- Add comprehensive test coverage for UICaption position handling
This is part 2 of moving position to the base class. UISprite and UIGrid
will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: move position property to UIDrawable base class (UIFrame)
- Add position member to UIDrawable base class
- Add common position getters/setters (x, y, pos) to base class
- Update UIFrame to use base class position instead of box position
- Synchronize box position with base class position for rendering
- Update all UIFrame methods to use base position consistently
- Add comprehensive test coverage for UIFrame position handling
This is part 1 of moving position to the base class. Other derived classes
(UICaption, UISprite, UIGrid) will be updated in subsequent commits.
Author: John McCardle <mccardle.john@gmail.com>
refactor: remove UIEntity collision_pos field
- Remove redundant collision_pos field from UIEntity
- Update position getters/setters to use integer-cast position when needed
- Remove all collision_pos synchronization code
- Simplify entity position handling to use single float position field
- Add comprehensive test coverage proving functionality is preserved
This removes technical debt and simplifies the codebase without changing API behavior.
Author: John McCardle <mccardle.john@gmail.com>
feat: add PyArgHelpers infrastructure for standardized argument parsing
- Create PyArgHelpers.h with parsing functions for position, size, grid coordinates, and color
- Support tuple-based vector arguments with conflict detection
- Provide consistent error messages and validation
- Add comprehensive test coverage for infrastructure
This sets the foundation for standardizing all Python API constructors.
Author: John McCardle <mccardle.john@gmail.com>
docs: mark Phase 6 (Rendering Revolution) as complete
Phase 6 is now complete with all core rendering features implemented:
Completed Features:
- Grid background colors (#50) - customizable backgrounds with animation
- RenderTexture overhaul (#6) - UIFrame clipping with opt-in architecture
- Viewport-based rendering (#8) - three scaling modes with coordinate transform
Strategic Decisions:
- UIGrid already has optimal RenderTexture implementation for its viewport needs
- UICaption/UISprite clipping deemed unnecessary (no children to clip)
- Effects/Shader/Particle systems deferred to post-Phase 7 for focused delivery
The rendering foundation is now solid and ready for Phase 7: Documentation & Distribution.
Author: John McCardle <mccardle.john@gmail.com>
feat(viewport): complete viewport-based rendering system (#8)
Implements a comprehensive viewport system that allows fixed game resolution
with flexible window scaling, addressing the primary wishes for issues #34, #49, and #8.
Key Features:
- Fixed game resolution independent of window size (window.game_resolution property)
- Three scaling modes accessible via window.scaling_mode:
- "center": 1:1 pixels, viewport centered in window
- "stretch": viewport fills window, ignores aspect ratio
- "fit": maintains aspect ratio with black bars
- Automatic window-to-game coordinate transformation for mouse input
- Full Python API integration with PyWindow properties
Technical Implementation:
- GameEngine::ViewportMode enum with Center, Stretch, Fit modes
- SFML View system for efficient GPU-based viewport scaling
- updateViewport() recalculates on window resize or mode change
- windowToGameCoords() transforms mouse coordinates correctly
- PyScene mouse input automatically uses transformed coordinates
Tests:
- test_viewport_simple.py: Basic API functionality
- test_viewport_visual.py: Visual verification with screenshots
- test_viewport_scaling.py: Interactive mode switching and resizing
This completes the viewport-based rendering task and provides the foundation
for resolution-independent game development as requested for Crypt of Sokoban.
Author: John McCardle <mccardle.john@gmail.com>
docs: update ROADMAP for Phase 6 progress
- Marked Phase 6 as IN PROGRESS
- Updated RenderTexture overhaul (#6) as PARTIALLY COMPLETE
- Marked Grid background colors (#50) as COMPLETED
- Added technical notes from implementation experience
- Identified viewport rendering (#8) as next priority
Author: John McCardle <mccardle.john@gmail.com>
feat(rendering): implement RenderTexture base infrastructure and UIFrame clipping (#6)
- Added RenderTexture support to UIDrawable base class
- std::unique_ptr<sf::RenderTexture> for opt-in rendering
- Dirty flag system for optimization
- enableRenderTexture() and markDirty() methods
- Implemented clip_children property for UIFrame
- Python-accessible boolean property
- Automatic RenderTexture creation when enabled
- Proper coordinate transformation for nested frames
- Updated UIFrame::render() for clipping support
- Renders to RenderTexture when clip_children=true
- Handles nested clipping correctly
- Only re-renders when dirty flag is set
- Added comprehensive dirty flag propagation
- All property setters mark frame as dirty
- Size changes recreate RenderTexture
- Animation system integration
- Created tests for clipping functionality
- Basic clipping test with visual verification
- Advanced nested clipping test
- Dynamic resize handling test
This is Phase 1 of the RenderTexture overhaul, providing the foundation
for advanced rendering effects like blur, glow, and viewport rendering.
Author: John McCardle <mccardle.john@gmail.com>
docs: create RenderTexture overhaul design document
- Comprehensive design for Issue #6 implementation
- Opt-in architecture to maintain backward compatibility
- Phased implementation plan with clear milestones
- Performance considerations and risk mitigation
- API design for clipping and future effects
Also includes Grid background color test
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): add customizable background_color property (#50)
- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access
Closes #50
Author: John McCardle <mccardle.john@gmail.com>
docs: update roadmap for Phase 6 preparation
- Mark Phase 5 (Window/Scene Architecture) as complete
- Update issue statuses (#34, #61, #1, #105 completed)
- Add Phase 6 implementation strategy for RenderTexture overhaul
- Archive Phase 5 test files to .archive/
- Identify quick wins and technical approach for rendering work
Author: John McCardle <mccardle.john@gmail.com>
feat(Phase 5): Complete Window/Scene Architecture
- Window singleton with properties (resolution, fullscreen, vsync, title)
- OOP Scene support with lifecycle methods (on_enter, on_exit, on_keypress, update)
- Window resize events trigger scene.on_resize callbacks
- Scene transitions (fade, slide_left/right/up/down) with smooth animations
- Full integration of Python Scene objects with C++ engine
All Phase 5 tasks (#34, #1, #61, #105) completed successfully.
Author: John McCardle <mccardle.john@gmail.com>
research: SFML 3.0 migration analysis
- Analyzed SFML 3.0 breaking changes (event system, scoped enums, C++17)
- Assessed migration impact on McRogueFace (40+ files affected)
- Evaluated timing relative to mcrfpy.sfml module plans
- Recommended deferring migration until after mcrfpy.sfml implementation
- Created SFML_3_MIGRATION_RESEARCH.md with comprehensive strategy
Author: John McCardle <mccardle.john@gmail.com>
research: SFML exposure options analysis (#14)
- Analyzed current SFML 2.6.1 usage throughout codebase
- Evaluated python-sfml (abandoned, only supports SFML 2.3.2)
- Recommended direct integration as mcrfpy.sfml module
- Created comprehensive SFML_EXPOSURE_RESEARCH.md with implementation plan
- Identified opportunity to provide modern SFML 2.6+ Python bindings
Author: John McCardle <mccardle.john@gmail.com>
feat: add basic profiling/metrics system (#104)
- Add ProfilingMetrics struct to track performance data
- Track frame time (current and 60-frame rolling average)
- Calculate FPS from average frame time
- Count draw calls, UI elements, and visible elements per frame
- Track total runtime and current frame number
- PyScene counts elements during render
- Expose metrics via mcrfpy.getMetrics() returning dict
This provides basic performance monitoring capabilities for
identifying bottlenecks and optimizing rendering performance.
Author: John McCardle <mccardle.john@gmail.com>
fix: improve click handling with proper z-order and coordinate transforms
- UIFrame: Fix coordinate transformation (subtract parent pos, not add)
- UIFrame: Check children in reverse order (highest z-index first)
- UIFrame: Skip invisible elements entirely
- PyScene: Sort elements by z-index before checking clicks
- PyScene: Stop at first element that handles the click
- UIGrid: Implement entity click detection with grid coordinate transform
- UIGrid: Check entities in reverse order, return sprite as target
Click events now correctly respect z-order (top elements get priority),
handle coordinate transforms for nested frames, and support clicking
on grid entities. Elements without click handlers are transparent to
clicks, allowing elements below to receive them.
Note: Click testing requires non-headless mode due to PyScene limitation.
feat: implement name system for finding UI elements (#39/40/41)
- Add 'name' property to UIDrawable base class
- All UI elements (Frame, Caption, Sprite, Grid, Entity) support .name
- Entity delegates name to its sprite member
- Add find(name, scene=None) function for exact match search
- Add findAll(pattern, scene=None) with wildcard support (* matches any sequence)
- Both functions search recursively through Frame children and Grid entities
- Comprehensive test coverage for all functionality
This provides a simple way to find UI elements by name in Python scripts,
supporting both exact matches and wildcard patterns.
Author: John McCardle <mccardle.john@gmail.com>
fix: prevent segfault when closing window via X button
- Add cleanup() method to GameEngine to clear Python references before destruction
- Clear timers and McRFPy_API references in proper order
- Call cleanup() at end of run loop and in destructor
- Ensure cleanup is only called once per GameEngine instance
Also includes:
- Fix audio ::stop() calls (already in place, OpenAL warning is benign)
- Add Caption support for x, y keywords (e.g. Caption("text", x=5, y=10))
- Refactor UIDrawable_methods.h into UIBase.h for better organization
- Move UIEntity-specific implementations to UIEntityPyMethods.h
Author: John McCardle <mccardle.john@gmail.com>
feat: stabilize test suite and add UIDrawable methods
- Add visible, opacity properties to all UI classes (#87, #88)
- Add get_bounds(), move(), resize() methods to UIDrawable (#89, #98)
- Create UIDrawable_methods.h with template implementations
- Fix test termination issues - all tests now exit properly
- Fix test_sprite_texture_swap.py click handler signature
- Fix test_drawable_base.py segfault in headless mode
- Convert audio objects to pointers for cleanup (OpenAL warning persists)
- Remove debug print statements from UICaption
- Special handling for UIEntity to delegate drawable methods to sprite
All test files are now "airtight" - they complete successfully,
terminate on their own, and handle edge cases properly.
Author: John McCardle <mccardle.john@gmail.com>
docs: add Phase 1-3 completion summary
- Document all completed tasks across three phases
- Show before/after API improvements
- Highlight technical achievements
- Outline next steps for Phase 4-7
Author: John McCardle <mccardle.john@gmail.com>
feat: implement mcrfpy.Timer object with pause/resume/cancel capabilities closes #103
- Created PyTimer.h/cpp with object-oriented timer interface
- Enhanced PyTimerCallable with pause/resume state tracking
- Added timer control methods: pause(), resume(), cancel(), restart()
- Added timer properties: interval, remaining, paused, active, callback
- Fixed timing logic to prevent rapid catch-up after resume
- Timer objects automatically register with game engine
- Added comprehensive test demonstrating all functionality
Author: John McCardle <mccardle.john@gmail.com>
feat(Color): add helper methods from_hex, to_hex, lerp closes #94
- Add Color.from_hex(hex_string) class method for creating colors from hex
- Support formats: #RRGGBB, RRGGBB, #RRGGBBAA, RRGGBBAA
- Add color.to_hex() to convert Color to hex string
- Add color.lerp(other, t) for smooth color interpolation
- Comprehensive test coverage for all methods
Author: John McCardle <mccardle.john@gmail.com>
fix: properly configure UTF-8 encoding for Python stdio
- Use PyConfig to set stdio_encoding="UTF-8" during initialization
- Set stdio_errors="surrogateescape" for robust handling
- Configure in both init_python() and init_python_with_config()
- Cleaner solution than wrapping streams after initialization
- Fixes UnicodeEncodeError when printing unicode characters
Author: John McCardle <mccardle.john@gmail.com>
feat(Vector): implement arithmetic operations closes #93
- Add PyNumberMethods with add, subtract, multiply, divide, negate, absolute
- Add rich comparison for equality/inequality checks
- Add boolean check (zero vector is False)
- Implement vector methods: magnitude(), normalize(), dot(), distance_to(), angle(), copy()
- Fix UIDrawable::get_click() segfault when click_callable is null
- Comprehensive test coverage for all arithmetic operations
Author: John McCardle <mccardle.john@gmail.com>
feat: Complete position argument standardization for all UI classes
- Frame and Sprite now support pos keyword override
- Entity now accepts x,y arguments (was pos-only before)
- All UI classes now consistently support:
- (x, y) positional
- ((x, y)) tuple
- x=x, y=y keywords
- pos=(x,y) keyword
- pos=Vector keyword
- Improves API consistency and flexibility
Author: John McCardle <mccardle.john@gmail.com>
feat: Standardize position arguments across all UI classes
- Create PyPositionHelper for consistent position parsing
- Grid.at() now accepts (x,y), ((x,y)), x=x, y=y, pos=(x,y)
- Caption now accepts x,y args in addition to pos
- Grid init fully supports keyword arguments
- Maintain backward compatibility for all formats
- Consistent error messages across classes
Author: John McCardle <mccardle.john@gmail.com>
feat: Add Entity.die() method for lifecycle management closes #30
- Remove entity from its grid's entity list
- Clear grid reference after removal
- Safe to call multiple times (no-op if not on grid)
- Works with shared_ptr entity management
Author: John McCardle <mccardle.john@gmail.com>
perf: Skip out-of-bounds entities during Grid rendering closes #52
- Add visibility bounds check in entity render loop
- Skip entities outside view with 1 cell margin
- Improves performance for large grids with many entities
- Bounds check considers zoom and pan settings
Author: John McCardle <mccardle.john@gmail.com>
verify: Sprite texture swapping functionality closes #19
- Texture property getter/setter already implemented
- Position/scale preservation during swap confirmed
- Type validation for texture assignment working
- Tests verify functionality is complete
Author: John McCardle <mccardle.john@gmail.com>
feat: Grid size tuple support closes #90
- Add grid_size keyword parameter to Grid.__init__
- Accept tuple or list of two integers
- Override grid_x/grid_y if grid_size provided
- Maintain backward compatibility
- Add comprehensive test coverage
Author: John McCardle <mccardle.john@gmail.com>
feat: Phase 1 - safe constructors and _Drawable foundation
Closes #7 - Make all UI class constructors safe:
- Added safe default constructors for UISprite, UIGrid, UIEntity, UICaption
- Initialize all members to predictable values
- Made Python init functions accept no arguments
- Added x,y properties to UIEntity
Closes #71 - Create _Drawable Python base class:
- Created PyDrawable.h/cpp with base type (not yet inherited by UI types)
- Registered in module initialization
Closes #87 - Add visible property:
- Added bool visible=true to UIDrawable base class
- All render methods check visibility before drawing
Closes #88 - Add opacity property:
- Added float opacity=1.0 to UIDrawable base class
- UICaption and UISprite apply opacity to alpha channel
Closes #89 - Add get_bounds() method:
- Virtual method returns sf::FloatRect(x,y,w,h)
- Implemented in Frame, Caption, Sprite, Grid
Closes #98 - Add move() and resize() methods:
- move(dx,dy) for relative movement
- resize(w,h) for absolute sizing
- Caption resize is no-op (size controlled by font)
Author: John McCardle <mccardle.john@gmail.com>
docs: comprehensive alpha_streamline_2 plan and strategic vision
- Add 7-phase development plan for alpha_streamline_2 branch
- Define architectural dependencies and critical path
- Identify new issues needed (Timer objects, event system, etc.)
- Add strategic vision document with 3 transformative directions
- Timeline: 10-12 weeks to solid Beta foundation
Author: John McCardle <mccardle.john@gmail.com>
feat(Grid): flexible at() method arguments
- Support tuple argument: grid.at((x, y))
- Support keyword arguments: grid.at(x=5, y=3)
- Support pos keyword: grid.at(pos=(2, 8))
- Maintain backward compatibility with grid.at(x, y)
- Add comprehensive error handling for invalid arguments
Improves API ergonomics and Python-like flexibility
2025-07-09 22:41:15 -04:00
|
|
|
value = position;
|
Squashed commit of the following: [interpreter_mode]
closes #63
closes #69
closes #59
closes #47
closes #2
closes #3
closes #33
closes #27
closes #73
closes #74
closes #78
I'd like to thank Claude Code for ~200-250M total tokens and 500-700k output tokens
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
commit 9bd1561bfc9b02d8db71b5d9390ef2631fac5b28
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 11:20:07 2025 -0400
Alpha 0.1 release
- Move RenderTexture (#6) out of alpha requirements, I don't need it
that badly
- alpha blockers resolved:
* Animation system (#59)
* Z-order rendering (#63)
* Python Sequence Protocol (#69)
* New README (#47)
* Removed deprecated methods (#2, #3)
🍾 McRogueFace 0.1.0
commit 43321487eb762e17639ba4113322b6f5df71a8d9
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:36:09 2025 -0400
Issue #63 (z-order rendering) complete
- Archive z-order test files
commit 90c318104bfb31ab4c741702e6661e6bf7e4d19c
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 10:34:06 2025 -0400
Fix Issue #63: Implement z-order rendering with dirty flag optimization
- Add dirty flags to PyScene and UIFrame to track when sorting is needed
- Implement lazy sorting - only sort when z_index changes or elements are added/removed
- Make Frame children respect z_index (previously rendered in insertion order only)
- Update UIDrawable::set_int to notify when z_index changes
- Mark collections dirty on append, remove, setitem, and slice operations
- Remove per-frame vector copy in PyScene::render for better performance
commit e4482e7189095d88eec1e2ec55e01e271ed4f55f
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 01:58:03 2025 -0400
Implement complete Python Sequence Protocol for collections (closes #69)
Major implementation of the full sequence protocol for both UICollection
and UIEntityCollection, making them behave like proper Python sequences.
Core Features Implemented:
- __setitem__ (collection[i] = value) with type validation
- __delitem__ (del collection[i]) with proper cleanup
- __contains__ (item in collection) by C++ pointer comparison
- __add__ (collection + other) returns Python list
- __iadd__ (collection += other) with full validation before modification
- Negative indexing support throughout
- Complete slice support (getting, setting, deletion)
- Extended slices with step \!= 1
- index() and count() methods
- Type safety enforced for all operations
UICollection specifics:
- Accepts Frame, Caption, Sprite, and Grid objects only
- Preserves z_index when replacing items
- Auto-assigns z_index on append (existing behavior maintained)
UIEntityCollection specifics:
- Accepts Entity objects only
- Manages grid references on add/remove/replace
- Uses std::list iteration with std::advance()
Also includes:
- Default value support for constructors:
- Caption accepts None for font (uses default_font)
- Grid accepts None for texture (uses default_texture)
- Sprite accepts None for texture (uses default_texture)
- Entity accepts None for texture (uses default_texture)
This completes Issue #69, removing it as an Alpha Blocker.
commit 70cf44f8f044ed49544dd9444245115187d3b318
Author: John McCardle <mccardle.john@gmail.com>
Date: Sat Jul 5 00:56:42 2025 -0400
Implement comprehensive animation system (closes #59)
- Add Animation class with 30+ easing functions (linear, ease in/out, quad, cubic, elastic, bounce, etc.)
- Add property system to all UI classes for animation support:
- UIFrame: position, size, colors (including individual r/g/b/a components)
- UICaption: position, size, text, colors
- UISprite: position, scale, sprite_number (with sequence support)
- UIGrid: position, size, camera center, zoom
- UIEntity: position, sprite properties
- Create AnimationManager singleton for frame-based updates
- Add Python bindings through PyAnimation wrapper
- Support for delta animations (relative values)
- Fix segfault when running scripts directly (mcrf_module initialization)
- Fix headless/windowed mode behavior to respect --headless flag
- Animations run purely in C++ without Python callbacks per frame
All UI properties are now animatable with smooth interpolation and professional easing curves.
commit 05bddae5112f2b5949a9d2b32dd3dc2bf4656837
Author: John McCardle <mccardle.john@gmail.com>
Date: Fri Jul 4 06:59:02 2025 -0400
Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect current features
- Updated GitHub Pages documentation site with:
- Modern landing page highlighting Crypt of Sokoban
- Comprehensive API reference (2700+ lines) with exhaustive examples
- Updated getting-started guide with installation and first game tutorial
- 8 detailed tutorials covering all major game systems
- Quick reference cheat sheet for common operations
- Generated documentation screenshots showing UI elements
- Fixed deprecated API references and added new features
- Added automation API documentation
- Included Python 3.12 requirement and platform-specific instructions
Note: Text rendering in headless mode has limitations for screenshots
commit af6a5e090b9f52e3328294a988bdc18ff4b6c981
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:58 2025 -0400
Update ROADMAP.md to reflect completion of Issues #2 and #3
- Marked both issues as completed with the removal of deprecated action system
- Updated open issue count from ~50 to ~48
- These were both Alpha blockers, bringing us closer to release
commit 281800cd2345cc57024c9bcdd18860d2bb8db027
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:43:22 2025 -0400
Remove deprecated registerPyAction/registerInputAction system (closes #2, closes #3)
This is our largest net-negative commit yet\! Removed the entire deprecated
action registration system that provided unnecessary two-step indirection:
keyboard → action string → Python callback
Removed components:
- McRFPy_API::_registerPyAction() and _registerInputAction() methods
- McRFPy_API::callbacks map for storing Python callables
- McRFPy_API::doAction() method for executing callbacks
- ACTIONPY macro from Scene.h for detecting "_py" suffixed actions
- Scene::registerActionInjected() and unregisterActionInjected() methods
- tests/api_registerPyAction_issue2_test.py (tested deprecated functionality)
The game now exclusively uses keypressScene() for keyboard input handling,
which is simpler and more direct. Also commented out the unused _camFollow
function that referenced non-existent do_camfollow variable.
commit cc8a7d20e8ea5c7b32cad2565cc9e85e27bef147
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:59 2025 -0400
Clean up temporary test files
commit ff83fd8bb159cd2e7d9056379576d147bd99656b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:13:46 2025 -0400
Update ROADMAP.md to reflect massive progress today
- Fixed 12+ critical bugs in a single session
- Implemented 3 missing features (Entity.index, EntityCollection.extend, sprite validation)
- Updated Phase 1 progress showing 11 of 12 items complete
- Added detailed summary of today's achievements with issue numbers
- Emphasized test-driven development approach used throughout
commit dae400031fe389025955bee423f9b327fd596b1d
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:12:29 2025 -0400
Remove deprecated player_input and turn-based functions for Issue #3
Removed the commented-out player_input(), computerTurn(), and playerTurn()
functions that were part of the old turn-based system. These are no longer
needed as input is now handled through Scene callbacks.
Partial fix for #3
commit cb0130b46eb873d7a38b4647b0f3d2698f234ab9
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:09:06 2025 -0400
Implement sprite index validation for Issue #33
Added validation to prevent setting sprite indices outside the valid
range for a texture. The implementation:
- Adds getSpriteCount() method to PyTexture to expose total sprites
- Validates sprite_number setter to ensure index is within bounds
- Provides clear error messages showing valid range
- Works for both Sprite and Entity objects
closes #33
commit 1e7f5e9e7e9e4d6e9494ba6c19f1ae0c5282b449
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:05:47 2025 -0400
Implement EntityCollection.extend() method for Issue #27
Added extend() method to EntityCollection that accepts any iterable
of Entity objects and adds them all to the collection. The method:
- Accepts lists, tuples, generators, or any iterable
- Validates all items are Entity objects
- Sets the grid association for each added entity
- Properly handles errors and empty iterables
closes #27
commit 923350137d148c56e617eae966467c77617c131b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 21:02:14 2025 -0400
Implement Entity.index() method for Issue #73
Added index() method to Entity class that returns the entity's
position in its parent grid's entity collection. This enables
proper entity removal patterns using entity.index().
commit 6134869371cf4e7ae79515690960a563fd0db40e
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:41:03 2025 -0400
Add validation to keypressScene() for non-callable arguments
Added PyCallable_Check validation to ensure keypressScene() only
accepts callable objects. Now properly raises TypeError with a
clear error message when passed non-callable arguments like
strings, numbers, None, or dicts.
commit 4715356b5e760b9fd8f2087565adaab2fb94573b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:31:36 2025 -0400
Fix Sprite texture setter 'error return without exception set'
Implemented the missing UISprite::set_texture method to properly:
- Validate the input is a Texture instance
- Update the sprite's texture using setTexture()
- Return appropriate error messages for invalid inputs
The setter now works correctly and no longer returns -1 without
setting an exception.
commit 6dd1cec600efd3b9f44f67968a23c88e05e19ec8
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 20:27:32 2025 -0400
Fix Entity property setters and PyVector implementation
Fixed the 'new style getargs format' error in Entity property setters by:
- Implementing PyObject_to_sfVector2f/2i using PyVector::from_arg
- Adding proper error checking in Entity::set_position
- Implementing PyVector get_member/set_member for x/y properties
- Fixing PyVector::from_arg to handle non-tuple arguments correctly
Now Entity.pos and Entity.sprite_number setters work correctly with
proper type validation.
commit f82b861bcdffa9d3df69bd29c7c88be2a30c9ba5
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:48:33 2025 -0400
Fix Issue #74: Add missing Grid.grid_y property
Added individual grid_x and grid_y getter properties to the Grid class
to complement the existing grid_size property. This allows direct access
to grid dimensions and fixes error messages that referenced these
properties before they existed.
closes #74
commit 59e6f8d53dda6938914ce854249925b3ce7f41f4
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:42:32 2025 -0400
Fix Issue #78: Middle mouse click no longer sends 'C' keyboard event
The bug was caused by accessing event.key.code on a mouse event without
checking the event type first. Since SFML uses a union for events, this
read garbage data. The middle mouse button value (2) coincidentally matched
the keyboard 'C' value (2), causing the spurious keyboard event.
Fixed by adding event type check before accessing key-specific fields.
Only keyboard events (KeyPressed/KeyReleased) now trigger key callbacks.
Test added to verify middle clicks no longer generate keyboard events.
Closes #78
commit 1c71d8d4f743900bf2bef097b3d1addf64dbe04a
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:36:15 2025 -0400
Fix Grid to support None/null texture and fix error message bug
- Allow Grid to be created with None as texture parameter
- Use default cell dimensions (16x16) when no texture provided
- Skip sprite rendering when texture is null, but still render colors
- Fix issue #77: Corrected copy/paste error in Grid.at() error messages
- Grid now functional for color-only rendering and entity positioning
Test created to verify Grid works without texture, showing colored cells.
Closes #77
commit 18cfe93a44a9f4dcde171f442dc3d56711a0906b
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 19:25:49 2025 -0400
Fix --exec interactive prompt bug and create comprehensive test suite
Major fixes:
- Fixed --exec entering Python REPL instead of game loop
- Resolved screenshot transparency issue (requires timer callbacks)
- Added debug output to trace Python initialization
Test suite created:
- 13 comprehensive tests covering all Python-exposed methods
- Tests use timer callback pattern for proper game loop interaction
- Discovered multiple critical bugs and missing features
Critical bugs found:
- Grid class segfaults on instantiation (blocks all Grid functionality)
- Issue #78 confirmed: Middle mouse click sends 'C' keyboard event
- Entity property setters have argument parsing errors
- Sprite texture setter returns improper error
- keypressScene() segfaults on non-callable arguments
Documentation updates:
- Updated CLAUDE.md with testing guidelines and TDD practices
- Created test reports documenting all findings
- Updated ROADMAP.md with test results and new priorities
The Grid segfault is now the highest priority as it blocks all Grid-based functionality.
commit 9ad0b6850d5f77d93c22eb52cbeb4d8442e77918
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 15:55:24 2025 -0400
Update ROADMAP.md to reflect Python interpreter and automation API progress
- Mark #32 (Python interpreter behavior) as 90% complete
- All major Python flags implemented: -h, -V, -c, -m, -i
- Script execution with proper sys.argv handling works
- Only stdin (-) support missing
- Note that new automation API enables:
- Automated UI testing capabilities
- Demo recording and playback
- Accessibility testing support
- Flag issues #53 and #45 as potentially aided by automation API
commit 7ec4698653383cb28f0115d1abf1db0a500257ec
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:57:59 2025 -0400
Update ROADMAP.md to remove closed issues
- Remove #72 (iterator improvements - closed)
- Remove #51 (UIEntity derive from UIDrawable - closed)
- Update issue counts: 64 open issues from original 78
- Update dependencies and references to reflect closed issues
- Clarify that core iterators are complete, only grid points remain
commit 68c1a016b0e1d1b438c926f5576e5650b9617fe1
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 14:27:01 2025 -0400
Implement --exec flag and PyAutoGUI-compatible automation API
- Add --exec flag to execute multiple scripts before main program
- Scripts are executed in order and share Python interpreter state
- Implement full PyAutoGUI-compatible automation API in McRFPy_Automation
- Add screenshot, mouse control, keyboard input capabilities
- Fix Python initialization issues when multiple scripts are loaded
- Update CommandLineParser to handle --exec with proper sys.argv management
- Add comprehensive examples and documentation
This enables automation testing by allowing test scripts to run alongside
games using the same Python environment. The automation API provides
event injection into the SFML render loop for UI testing.
Closes #32 partially (Python interpreter emulation)
References automation testing requirements
commit 763fa201f041a0d32bc45695c1bbbac5590adba0
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 10:43:17 2025 -0400
Python command emulation
commit a44b8c93e938ca0c58cff7e5157293d97d182a39
Author: John McCardle <mccardle.john@gmail.com>
Date: Thu Jul 3 09:42:46 2025 -0400
Prep: Cleanup for interpreter mode
2025-07-05 12:04:20 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "size") {
|
|
|
|
|
value = box.getSize();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else if (name == "center") {
|
|
|
|
|
value = sf::Vector2f(center_x, center_y);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2026-01-04 15:32:14 -05:00
|
|
|
|
|
|
|
|
bool UIGrid::hasProperty(const std::string& name) const {
|
|
|
|
|
// Float properties
|
|
|
|
|
if (name == "x" || name == "y" ||
|
|
|
|
|
name == "w" || name == "h" || name == "width" || name == "height" ||
|
|
|
|
|
name == "center_x" || name == "center_y" || name == "zoom" ||
|
|
|
|
|
name == "z_index" ||
|
|
|
|
|
name == "fill_color.r" || name == "fill_color.g" ||
|
|
|
|
|
name == "fill_color.b" || name == "fill_color.a") {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
// Vector2f properties
|
|
|
|
|
if (name == "position" || name == "size" || name == "center") {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|