McRogueFace/src/UIGrid.cpp

1333 lines
46 KiB
C++
Raw Normal View History

Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
#include "UIGrid.h"
#include "GameEngine.h"
#include "McRFPy_API.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
#include <algorithm>
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
UIGrid::UIGrid() {}
UIGrid::UIGrid(int gx, int gy, std::shared_ptr<PyTexture> _ptex, sf::Vector2f _xy, sf::Vector2f _wh)
: grid_x(gx), grid_y(gy),
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
zoom(1.0f),
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
ptex(_ptex), points(gx * gy)
{
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;
center_x = (gx/2) * cell_width;
center_y = (gy/2) * cell_height;
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
entities = std::make_shared<std::list<std::shared_ptr<UIEntity>>>();
box.setSize(_wh);
box.setPosition(_xy);
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
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);
}
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
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());
}
void UIGrid::update() {}
void UIGrid::render(sf::Vector2f offset, sf::RenderTarget& target)
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
{
output.setPosition(box.getPosition() + offset); // output sprite can move; update position when drawing
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
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));
renderTexture.clear(sf::Color(8, 8, 8, 255)); // TODO - UIGrid needs a "background color" field
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;
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
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;
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
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);
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
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);
//sprite.setScale(sf::Vector2f(zoom, zoom));
sf::RectangleShape r; // for colors and overlays
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
r.setSize(sf::Vector2f(cell_width * zoom, cell_height * zoom));
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
r.setOutlineThickness(0);
int x_limit = left_edge + width_sq + 2;
if (x_limit > grid_x) x_limit = grid_x;
int y_limit = top_edge + height_sq + 2;
if (y_limit > grid_y) y_limit = grid_y;
// base layer - bottom color, tile sprite ("ground")
for (int x = (left_edge - 1 >= 0 ? left_edge - 1 : 0);
x < x_limit; //x < view_width;
x+=1)
{
//for (float y = (top_edge >= 0 ? top_edge : 0);
for (int y = (top_edge - 1 >= 0 ? top_edge - 1 : 0);
y < y_limit; //y < view_height;
y+=1)
{
auto pixel_pos = sf::Vector2f(
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
(x*cell_width - left_spritepixels) * zoom,
(y*cell_height - top_spritepixels) * zoom );
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
auto gridpoint = at(std::floor(x), std::floor(y));
//sprite.setPosition(pixel_pos);
r.setPosition(pixel_pos);
r.setFillColor(gridpoint.color);
renderTexture.draw(r);
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
// tilesprite - only draw if texture is available
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
// if discovered but not visible, set opacity to 90%
// if not discovered... just don't draw it?
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 (ptex && gridpoint.tilesprite != -1) {
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
sprite = ptex->sprite(gridpoint.tilesprite, pixel_pos, sf::Vector2f(zoom, zoom)); //setSprite(gridpoint.tilesprite);;
renderTexture.draw(sprite);
}
}
}
// middle layer - entities
// disabling entity rendering until I can render their UISprite inside the rendertexture (not directly to window)
for (auto e : *entities) {
// TODO skip out-of-bounds entities (grid square not visible at all, check for partially on visible grid squares / floating point grid position)
//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(
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
(e->position.x*cell_width - left_spritepixels) * zoom,
(e->position.y*cell_height - top_spritepixels) * zoom );
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
//drawent.setPosition(pixel_pos);
//renderTexture.draw(drawent);
drawent.render(pixel_pos, renderTexture);
}
// top layer - opacity for discovered / visible status (debug, basically)
/* // Disabled until I attach a "perspective"
for (int x = (left_edge - 1 >= 0 ? left_edge - 1 : 0);
x < x_limit; //x < view_width;
x+=1)
{
//for (float y = (top_edge >= 0 ? top_edge : 0);
for (int y = (top_edge - 1 >= 0 ? top_edge - 1 : 0);
y < y_limit; //y < view_height;
y+=1)
{
auto pixel_pos = sf::Vector2f(
(x*itex->grid_size - left_spritepixels) * zoom,
(y*itex->grid_size - top_spritepixels) * zoom );
auto gridpoint = at(std::floor(x), std::floor(y));
sprite.setPosition(pixel_pos);
r.setPosition(pixel_pos);
// visible & discovered layers for testing purposes
if (!gridpoint.discovered) {
r.setFillColor(sf::Color(16, 16, 20, 192)); // 255 opacity for actual blackout
renderTexture.draw(r);
} else if (!gridpoint.visible) {
r.setFillColor(sf::Color(32, 32, 40, 128));
renderTexture.draw(r);
}
// overlay
// uisprite
}
}
*/
// 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();
//Resources::game->getWindow().draw(output);
target.draw(output);
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
}
UIGridPoint& UIGrid::at(int x, int y)
{
return points[y * grid_x + x];
}
PyObjectsEnum UIGrid::derived_type()
{
return PyObjectsEnum::UIGRID;
}
std::shared_ptr<PyTexture> UIGrid::getTexture()
{
return ptex;
}
UIDrawable* UIGrid::click_at(sf::Vector2f point)
{
if (click_callable)
{
if(box.getGlobalBounds().contains(point)) return this;
}
return NULL;
}
int UIGrid::init(PyUIGridObject* self, PyObject* args, PyObject* kwds) {
int grid_x, grid_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
PyObject* textureObj = Py_None;
//float box_x, box_y, box_w, box_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
PyObject* pos = NULL;
PyObject* size = NULL;
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
//if (!PyArg_ParseTuple(args, "iiOffff", &grid_x, &grid_y, &textureObj, &box_x, &box_y, &box_w, &box_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
if (!PyArg_ParseTuple(args, "ii|OOO", &grid_x, &grid_y, &textureObj, &pos, &size)) {
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
return -1; // If parsing fails, return an error
}
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
// Default position and size if not provided
PyVectorObject* pos_result = NULL;
PyVectorObject* size_result = NULL;
if (pos) {
pos_result = PyVector::from_arg(pos);
if (!pos_result)
{
PyErr_SetString(PyExc_TypeError, "pos must be a mcrfpy.Vector instance or arguments to mcrfpy.Vector.__init__");
return -1;
}
} else {
// Default position (0, 0)
PyObject* vector_class = PyObject_GetAttrString(McRFPy_API::mcrf_module, "Vector");
if (vector_class) {
PyObject* pos_obj = PyObject_CallFunction(vector_class, "ff", 0.0f, 0.0f);
Py_DECREF(vector_class);
if (pos_obj) {
pos_result = (PyVectorObject*)pos_obj;
}
}
if (!pos_result) {
PyErr_SetString(PyExc_RuntimeError, "Failed to create default position vector");
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
if (size) {
size_result = PyVector::from_arg(size);
if (!size_result)
{
PyErr_SetString(PyExc_TypeError, "size must be a mcrfpy.Vector instance or arguments to mcrfpy.Vector.__init__");
return -1;
}
} else {
// Default size based on grid dimensions
float default_w = grid_x * 16.0f; // Assuming 16 pixel tiles
float default_h = grid_y * 16.0f;
PyObject* vector_class = PyObject_GetAttrString(McRFPy_API::mcrf_module, "Vector");
if (vector_class) {
PyObject* size_obj = PyObject_CallFunction(vector_class, "ff", default_w, default_h);
Py_DECREF(vector_class);
if (size_obj) {
size_result = (PyVectorObject*)size_obj;
}
}
if (!size_result) {
PyErr_SetString(PyExc_RuntimeError, "Failed to create default size vector");
return -1;
}
}
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
// Convert PyObject texture to IndexTexture*
// This requires the texture object to have been initialized similar to UISprite's texture handling
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;
// Allow None for texture - use default texture in that case
if (textureObj != Py_None) {
//if (!PyObject_IsInstance(textureObj, (PyObject*)&PyTextureType)) {
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 {
// Use default texture when None is provided
texture_ptr = McRFPy_API::default_texture;
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
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
// Initialize UIGrid - texture_ptr will be nullptr if texture was None
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
//self->data = new UIGrid(grid_x, grid_y, texture, sf::Vector2f(box_x, box_y), sf::Vector2f(box_w, box_h));
//self->data = std::make_shared<UIGrid>(grid_x, grid_y, pyTexture->data,
// sf::Vector2f(box_x, box_y), sf::Vector2f(box_w, box_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
self->data = std::make_shared<UIGrid>(grid_x, grid_y, texture_ptr, pos_result->data, size_result->data);
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
return 0; // Success
}
PyObject* UIGrid::get_grid_size(PyUIGridObject* self, void* closure) {
return Py_BuildValue("(ii)", self->data->grid_x, self->data->grid_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
PyObject* UIGrid::get_grid_x(PyUIGridObject* self, void* closure) {
return PyLong_FromLong(self->data->grid_x);
}
PyObject* UIGrid::get_grid_y(PyUIGridObject* self, void* closure) {
return PyLong_FromLong(self->data->grid_y);
}
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
PyObject* UIGrid::get_position(PyUIGridObject* self, void* closure) {
auto& box = self->data->box;
return Py_BuildValue("(ff)", box.getPosition().x, box.getPosition().y);
}
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;
}
self->data->box.setPosition(x, y);
return 0;
}
PyObject* UIGrid::get_size(PyUIGridObject* self, void* closure) {
auto& box = self->data->box;
return Py_BuildValue("(ff)", box.getSize().x, box.getSize().y);
}
int UIGrid::set_size(PyUIGridObject* self, PyObject* value, void* closure) {
float w, h;
if (!PyArg_ParseTuple(value, "ff", &w, &h)) {
PyErr_SetString(PyExc_ValueError, "Size must be a tuple of two floats");
return -1;
}
self->data->box.setSize(sf::Vector2f(w, h));
return 0;
}
PyObject* UIGrid::get_center(PyUIGridObject* self, void* closure) {
return Py_BuildValue("(ff)", self->data->center_x, self->data->center_y);
}
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)
{
auto member_ptr = reinterpret_cast<long>(closure);
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;
auto member_ptr = reinterpret_cast<long>(closure);
if (PyFloat_Check(value))
{
val = PyFloat_AsDouble(value);
}
else if (PyLong_Check(value))
{
val = PyLong_AsLong(value);
}
else
{
PyErr_SetString(PyExc_TypeError, "Value must be a floating point number.");
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
self->data->box.setSize(sf::Vector2f(val, self->data->box.getSize().y));
else if (member_ptr == 3) // h
self->data->box.setSize(sf::Vector2f(self->data->box.getSize().x, val));
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;
}
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
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;
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
return (PyObject*)obj;
}
PyObject* UIGrid::py_at(PyUIGridObject* self, PyObject* o)
{
int x, y;
if (!PyArg_ParseTuple(o, "ii", &x, &y)) {
PyErr_SetString(PyExc_TypeError, "UIGrid.at requires two integer arguments: (x, y)");
return NULL;
}
if (x < 0 || x >= self->data->grid_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
PyErr_SetString(PyExc_ValueError, "x value out of range (0, Grid.grid_x)");
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
return NULL;
}
if (y < 0 || y >= self->data->grid_y) {
PyErr_SetString(PyExc_ValueError, "y value out of range (0, Grid.grid_y)");
return NULL;
}
//PyUIGridPointObject* obj = (PyUIGridPointObject*)((&PyUIGridPointType)->tp_alloc(&PyUIGridPointType, 0));
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "GridPoint");
auto obj = (PyUIGridPointObject*)type->tp_alloc(type, 0);
//auto target = std::static_pointer_cast<UIEntity>(target);
obj->data = &(self->data->points[x + self->data->grid_x * y]);
obj->grid = self->data;
return (PyObject*)obj;
}
PyMethodDef UIGrid::methods[] = {
{"at", (PyCFunction)UIGrid::py_at, METH_O},
{NULL, NULL, 0, NULL}
};
PyGetSetDef UIGrid::getsetters[] = {
// TODO - refactor into get_vector_member with field identifier values `(void*)n`
{"grid_size", (getter)UIGrid::get_grid_size, NULL, "Grid dimensions (grid_x, grid_y)", NULL},
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
{"grid_x", (getter)UIGrid::get_grid_x, NULL, "Grid x dimension", NULL},
{"grid_y", (getter)UIGrid::get_grid_y, NULL, "Grid y dimension", NULL},
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
{"position", (getter)UIGrid::get_position, (setter)UIGrid::set_position, "Position of the grid (x, y)", NULL},
{"size", (getter)UIGrid::get_size, (setter)UIGrid::set_size, "Size of the grid (width, height)", NULL},
{"center", (getter)UIGrid::get_center, (setter)UIGrid::set_center, "Grid coordinate at the center of the Grid's view (pan)", NULL},
{"entities", (getter)UIGrid::get_children, NULL, "EntityCollection of entities on this grid", NULL},
{"x", (getter)UIGrid::get_float_member, (setter)UIGrid::set_float_member, "top-left corner X-coordinate", (void*)0},
{"y", (getter)UIGrid::get_float_member, (setter)UIGrid::set_float_member, "top-left corner Y-coordinate", (void*)1},
{"w", (getter)UIGrid::get_float_member, (setter)UIGrid::set_float_member, "visible widget width", (void*)2},
{"h", (getter)UIGrid::get_float_member, (setter)UIGrid::set_float_member, "visible widget height", (void*)3},
{"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},
{"click", (getter)UIDrawable::get_click, (setter)UIDrawable::set_click, "Object called with (x, y, button) when clicked", (void*)PyObjectsEnum::UIGRID},
{"texture", (getter)UIGrid::get_texture, NULL, "Texture of the grid", NULL}, //TODO 7DRL-day2-item5
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
{"z_index", (getter)UIDrawable::get_int, (setter)UIDrawable::set_int, "Z-order for rendering (lower values rendered first)", (void*)PyObjectsEnum::UIGRID},
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
{NULL} /* Sentinel */
};
PyObject* UIGrid::get_children(PyUIGridObject* self, void* closure)
{
// create PyUICollection instance pointing to self->data->children
//PyUIEntityCollectionObject* o = (PyUIEntityCollectionObject*)PyUIEntityCollectionType.tp_alloc(&PyUIEntityCollectionType, 0);
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "EntityCollection");
auto o = (PyUIEntityCollectionObject*)type->tp_alloc(type, 0);
if (o) {
o->data = self->data->entities; // todone. / BUGFIX - entities isn't a shared pointer on UIGrid, what to do? -- I made it a sp<list<sp<UIEntity>>>
o->grid = self->data;
}
return (PyObject*)o;
}
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");
}
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
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);
}
*/
int UIEntityCollectionIter::init(PyUIEntityCollectionIterObject* self, PyObject* args, PyObject* kwds)
{
PyErr_SetString(PyExc_TypeError, "UICollection cannot be instantiated: a C++ data source is required.");
return -1;
}
PyObject* UIEntityCollectionIter::next(PyUIEntityCollectionIterObject* self)
{
if (self->data->size() != self->start_size)
{
PyErr_SetString(PyExc_RuntimeError, "collection changed size during iteration");
return NULL;
}
if (self->index > self->start_size - 1)
{
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
self->index++;
auto vec = self->data.get();
if (!vec)
{
PyErr_SetString(PyExc_RuntimeError, "the collection store returned a null pointer");
return NULL;
}
Iterators, other Python C API improvements closes #72 ref #69 - this resolves the "UICollection" (not "UIEntityCollection", perhaps renamed since the issue opened) and "UIEntityCollection" portion. The Grid point based iterators were not updated. **RPATH updates** Will this RPATH setting allow McRogueFace to execute using its included "lib" subdirectory after being unzipped on a new computer? The change from "./lib" to "$ORIGIN/./lib" improves portability. The $ORIGIN token is a special Linux/Unix convention that refers to the directory containing the executable itself. This makes the path relative to the executable's location rather than the current working directory, which means McRogueFace will correctly find its libraries in the lib subdirectory regardless of where it's run from after being unzipped on a new computer. **New standard object initialization** PyColor, PyVector - Fixed all 15 PyTypeObject definitions to use proper designated initializer syntax - Replaced PyType_GenericAlloc usage in PyColor.cpp and PyVector.cpp - Updated PyObject_New usage in UIEntity.cpp - All object creation now uses module-based type lookups instead of static references - Created centralized utilities in PyObjectUtils.h **RAII Wrappers** automatic reference counting via C++ object lifecycle - Created PyRAII.h with PyObjectRef and PyTypeRef classes - These provide automatic reference counting management - Updated PyColor::from_arg() to demonstrate RAII usage - Prevents memory leaks and reference counting errors **Python object base in type defs:** `.ob_base = {.ob_base = {.ob_refcnt = 1, .ob_type = NULL}, .ob_size = 0}` PyColor, PyTexture, PyVector, UICaption, UICollection, UIEntity, UIFrame, UIGrid **convertDrawableToPython** replace crazy macro to detect the correct Python type of a UIDrawable instance - Removed the problematic macro from UIDrawable.h - Created template-based functions in PyObjectUtils.h - Updated UICollection.cpp to use local helper function - The new approach is cleaner, more debuggable, and avoids static type references **Iterator fixes** tp_iter on UICollection, UIGrid, UIGridPoint, UISprite UIGrid logic improved, standard **List vs Vector usage analysis** there are different use cases that weren't standardized: - UICollection (for Frame children) uses std::vector<std::shared_ptr<UIDrawable>> - UIEntityCollection (for Grid entities) uses std::list<std::shared_ptr<UIEntity>> The rationale is currently connected to frequency of expected changes. * A "UICollection" is likely either all visible or not; it's also likely to be created once and have a static set of contents. They should be contiguous in memory in hopes that this helps rendering speed. * A "UIEntityCollection" is expected to be rendered as a subset within the visible rectangle of the UIGrid. Scrolling the grid or gameplay logic is likely to frequently create and destroy entities. In general I expect Entity collections to have a much higher common size than UICollections. For these reasons I've made them Lists in hopes that they never have to be reallocated or moved during a frame.
2025-05-31 08:58:52 -04:00
// Advance list iterator since Entities are stored in a list, not a vector
auto l_begin = (*vec).begin();
std::advance(l_begin, self->index-1);
auto target = *l_begin;
// Create and return a Python Entity object
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity");
auto o = (PyUIEntityObject*)type->tp_alloc(type, 0);
auto p = std::static_pointer_cast<UIEntity>(target);
o->data = p;
return (PyObject*)o;
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
}
PyObject* UIEntityCollectionIter::repr(PyUIEntityCollectionIterObject* self)
{
std::ostringstream ss;
if (!self->data) ss << "<UICollectionIter (invalid internal object)>";
else {
ss << "<UICollectionIter (" << self->data->size() << " child objects, @ index " << self->index << ")>";
}
std::string repr_str = ss.str();
return PyUnicode_DecodeUTF8(repr_str.c_str(), repr_str.size(), "replace");
}
Py_ssize_t UIEntityCollection::len(PyUIEntityCollectionObject* self) {
return self->data->size();
}
PyObject* UIEntityCollection::getitem(PyUIEntityCollectionObject* self, Py_ssize_t index) {
// build a Python version of item at self->data[index]
// Copy pasted::
auto vec = self->data.get();
if (!vec)
{
PyErr_SetString(PyExc_RuntimeError, "the collection store returned a null pointer");
return NULL;
}
while (index < 0) index += self->data->size();
if (index > self->data->size() - 1)
{
PyErr_SetString(PyExc_IndexError, "EntityCollection index out of range");
return NULL;
}
auto l_begin = (*vec).begin();
std::advance(l_begin, index);
auto target = *l_begin; //auto target = (*vec)[index];
//RET_PY_INSTANCE(target);
// construct and return an entity object that points directly into the UIGrid's entity vector
//PyUIEntityObject* o = (PyUIEntityObject*)((&PyUIEntityType)->tp_alloc(&PyUIEntityType, 0));
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity");
auto o = (PyUIEntityObject*)type->tp_alloc(type, 0);
auto p = std::static_pointer_cast<UIEntity>(target);
o->data = p;
return (PyObject*)o;
return NULL;
}
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
int UIEntityCollection::setitem(PyUIEntityCollectionObject* self, Py_ssize_t index, PyObject* value) {
auto list = self->data.get();
if (!list) {
PyErr_SetString(PyExc_RuntimeError, "the collection store returned a null pointer");
return -1;
}
// Handle negative indexing
while (index < 0) index += list->size();
// Bounds check
if (index >= list->size()) {
PyErr_SetString(PyExc_IndexError, "EntityCollection assignment index out of range");
return -1;
}
// Get iterator to the target position
auto it = list->begin();
std::advance(it, index);
// Handle deletion
if (value == NULL) {
// Clear grid reference from the entity being removed
(*it)->grid = nullptr;
list->erase(it);
return 0;
}
// Type checking - must be an Entity
if (!PyObject_IsInstance(value, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity"))) {
PyErr_SetString(PyExc_TypeError, "EntityCollection can only contain Entity objects");
return -1;
}
// Get the C++ object from the Python object
PyUIEntityObject* entity = (PyUIEntityObject*)value;
if (!entity->data) {
PyErr_SetString(PyExc_RuntimeError, "Invalid Entity object");
return -1;
}
// Clear grid reference from the old entity
(*it)->grid = nullptr;
// Replace the element and set grid reference
*it = entity->data;
entity->data->grid = self->grid;
return 0;
}
int UIEntityCollection::contains(PyUIEntityCollectionObject* self, PyObject* value) {
auto list = self->data.get();
if (!list) {
PyErr_SetString(PyExc_RuntimeError, "the collection store returned a null pointer");
return -1;
}
// Type checking - must be an Entity
if (!PyObject_IsInstance(value, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity"))) {
// Not an Entity, so it can't be in the collection
return 0;
}
// Get the C++ object from the Python object
PyUIEntityObject* entity = (PyUIEntityObject*)value;
if (!entity->data) {
return 0;
}
// Search for the object by comparing C++ pointers
for (const auto& ent : *list) {
if (ent.get() == entity->data.get()) {
return 1; // Found
}
}
return 0; // Not found
}
PyObject* UIEntityCollection::concat(PyUIEntityCollectionObject* self, PyObject* other) {
// Create a new Python list containing elements from both collections
if (!PySequence_Check(other)) {
PyErr_SetString(PyExc_TypeError, "can only concatenate sequence to EntityCollection");
return NULL;
}
Py_ssize_t self_len = self->data->size();
Py_ssize_t other_len = PySequence_Length(other);
if (other_len == -1) {
return NULL; // Error already set
}
PyObject* result_list = PyList_New(self_len + other_len);
if (!result_list) {
return NULL;
}
// Add all elements from self
Py_ssize_t idx = 0;
for (const auto& entity : *self->data) {
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity");
auto obj = (PyUIEntityObject*)type->tp_alloc(type, 0);
if (obj) {
obj->data = entity;
PyList_SET_ITEM(result_list, idx, (PyObject*)obj); // Steals reference
} else {
Py_DECREF(result_list);
Py_DECREF(type);
return NULL;
}
Py_DECREF(type);
idx++;
}
// Add all elements from other
for (Py_ssize_t i = 0; i < other_len; i++) {
PyObject* item = PySequence_GetItem(other, i);
if (!item) {
Py_DECREF(result_list);
return NULL;
}
PyList_SET_ITEM(result_list, self_len + i, item); // Steals reference
}
return result_list;
}
PyObject* UIEntityCollection::inplace_concat(PyUIEntityCollectionObject* self, PyObject* other) {
if (!PySequence_Check(other)) {
PyErr_SetString(PyExc_TypeError, "can only concatenate sequence to EntityCollection");
return NULL;
}
// First, validate ALL items in the sequence before modifying anything
Py_ssize_t other_len = PySequence_Length(other);
if (other_len == -1) {
return NULL; // Error already set
}
// Validate all items first
for (Py_ssize_t i = 0; i < other_len; i++) {
PyObject* item = PySequence_GetItem(other, i);
if (!item) {
return NULL;
}
// Type check
if (!PyObject_IsInstance(item, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity"))) {
Py_DECREF(item);
PyErr_Format(PyExc_TypeError,
"EntityCollection can only contain Entity objects; "
"got %s at index %zd", Py_TYPE(item)->tp_name, i);
return NULL;
}
Py_DECREF(item);
}
// All items validated, now we can safely add them
for (Py_ssize_t i = 0; i < other_len; i++) {
PyObject* item = PySequence_GetItem(other, i);
if (!item) {
return NULL; // Shouldn't happen, but be safe
}
// Use the existing append method which handles grid references
PyObject* result = append(self, item);
Py_DECREF(item);
if (!result) {
return NULL; // append() failed
}
Py_DECREF(result); // append returns Py_None
}
Py_INCREF(self);
return (PyObject*)self;
}
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
PySequenceMethods UIEntityCollection::sqmethods = {
.sq_length = (lenfunc)UIEntityCollection::len,
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
.sq_concat = (binaryfunc)UIEntityCollection::concat,
.sq_repeat = NULL,
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
.sq_item = (ssizeargfunc)UIEntityCollection::getitem,
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
.was_sq_slice = NULL,
.sq_ass_item = (ssizeobjargproc)UIEntityCollection::setitem,
.was_sq_ass_slice = NULL,
.sq_contains = (objobjproc)UIEntityCollection::contains,
.sq_inplace_concat = (binaryfunc)UIEntityCollection::inplace_concat,
.sq_inplace_repeat = NULL
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
};
PyObject* UIEntityCollection::append(PyUIEntityCollectionObject* self, PyObject* o)
{
// if not UIDrawable subclass, reject it
// self->data->push_back( c++ object inside o );
// this would be a great use case for .tp_base
//if (!PyObject_IsInstance(o, (PyObject*)&PyUIEntityType))
if (!PyObject_IsInstance(o, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity")))
{
PyErr_SetString(PyExc_TypeError, "Only Entity objects can be added to EntityCollection");
return NULL;
}
PyUIEntityObject* entity = (PyUIEntityObject*)o;
self->data->push_back(entity->data);
entity->data->grid = self->grid;
Py_INCREF(Py_None);
return Py_None;
}
PyObject* UIEntityCollection::remove(PyUIEntityCollectionObject* self, PyObject* o)
{
if (!PyLong_Check(o))
{
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
PyErr_SetString(PyExc_TypeError, "EntityCollection.remove requires an integer index to remove");
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
return NULL;
}
long index = PyLong_AsLong(o);
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
// Handle negative indexing
while (index < 0) index += self->data->size();
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
if (index >= self->data->size())
{
PyErr_SetString(PyExc_ValueError, "Index out of range");
return NULL;
}
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 iterator to the entity to remove
auto it = self->data->begin();
std::advance(it, index);
// Clear grid reference before removing
(*it)->grid = nullptr;
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
// release the shared pointer at correct part of the list
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
self->data->erase(it);
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
Py_INCREF(Py_None);
return 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
PyObject* UIEntityCollection::extend(PyUIEntityCollectionObject* self, PyObject* o)
{
// Accept any iterable of Entity objects
PyObject* iterator = PyObject_GetIter(o);
if (iterator == NULL) {
PyErr_SetString(PyExc_TypeError, "UIEntityCollection.extend requires an iterable");
return NULL;
}
PyObject* item;
while ((item = PyIter_Next(iterator)) != NULL) {
// Check if item is an Entity
if (!PyObject_IsInstance(item, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity"))) {
Py_DECREF(item);
Py_DECREF(iterator);
PyErr_SetString(PyExc_TypeError, "All items in iterable must be Entity objects");
return NULL;
}
// Add the entity to the collection
PyUIEntityObject* entity = (PyUIEntityObject*)item;
self->data->push_back(entity->data);
entity->data->grid = self->grid;
Py_DECREF(item);
}
Py_DECREF(iterator);
// Check if iteration ended due to an error
if (PyErr_Occurred()) {
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
PyObject* UIEntityCollection::index_method(PyUIEntityCollectionObject* self, PyObject* value) {
auto list = self->data.get();
if (!list) {
PyErr_SetString(PyExc_RuntimeError, "the collection store returned a null pointer");
return NULL;
}
// Type checking - must be an Entity
if (!PyObject_IsInstance(value, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity"))) {
PyErr_SetString(PyExc_TypeError, "EntityCollection.index requires an Entity object");
return NULL;
}
// Get the C++ object from the Python object
PyUIEntityObject* entity = (PyUIEntityObject*)value;
if (!entity->data) {
PyErr_SetString(PyExc_RuntimeError, "Invalid Entity object");
return NULL;
}
// Search for the object
Py_ssize_t idx = 0;
for (const auto& ent : *list) {
if (ent.get() == entity->data.get()) {
return PyLong_FromSsize_t(idx);
}
idx++;
}
PyErr_SetString(PyExc_ValueError, "Entity not in EntityCollection");
return NULL;
}
PyObject* UIEntityCollection::count(PyUIEntityCollectionObject* self, PyObject* value) {
auto list = self->data.get();
if (!list) {
PyErr_SetString(PyExc_RuntimeError, "the collection store returned a null pointer");
return NULL;
}
// Type checking - must be an Entity
if (!PyObject_IsInstance(value, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity"))) {
// Not an Entity, so count is 0
return PyLong_FromLong(0);
}
// Get the C++ object from the Python object
PyUIEntityObject* entity = (PyUIEntityObject*)value;
if (!entity->data) {
return PyLong_FromLong(0);
}
// Count occurrences
Py_ssize_t count = 0;
for (const auto& ent : *list) {
if (ent.get() == entity->data.get()) {
count++;
}
}
return PyLong_FromSsize_t(count);
}
PyObject* UIEntityCollection::subscript(PyUIEntityCollectionObject* self, PyObject* key) {
if (PyLong_Check(key)) {
// Single index - delegate to sq_item
Py_ssize_t index = PyLong_AsSsize_t(key);
if (index == -1 && PyErr_Occurred()) {
return NULL;
}
return getitem(self, index);
} else if (PySlice_Check(key)) {
// Handle slice
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx(key, self->data->size(), &start, &stop, &step, &slicelength) < 0) {
return NULL;
}
PyObject* result_list = PyList_New(slicelength);
if (!result_list) {
return NULL;
}
// Iterate through the list with slice parameters
auto it = self->data->begin();
for (Py_ssize_t i = 0, cur = start; i < slicelength; i++, cur += step) {
auto cur_it = it;
std::advance(cur_it, cur);
auto type = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity");
auto obj = (PyUIEntityObject*)type->tp_alloc(type, 0);
if (obj) {
obj->data = *cur_it;
PyList_SET_ITEM(result_list, i, (PyObject*)obj); // Steals reference
} else {
Py_DECREF(result_list);
Py_DECREF(type);
return NULL;
}
Py_DECREF(type);
}
return result_list;
} else {
PyErr_Format(PyExc_TypeError, "EntityCollection indices must be integers or slices, not %.200s",
Py_TYPE(key)->tp_name);
return NULL;
}
}
int UIEntityCollection::ass_subscript(PyUIEntityCollectionObject* self, PyObject* key, PyObject* value) {
if (PyLong_Check(key)) {
// Single index - delegate to sq_ass_item
Py_ssize_t index = PyLong_AsSsize_t(key);
if (index == -1 && PyErr_Occurred()) {
return -1;
}
return setitem(self, index, value);
} else if (PySlice_Check(key)) {
// Handle slice assignment/deletion
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx(key, self->data->size(), &start, &stop, &step, &slicelength) < 0) {
return -1;
}
if (value == NULL) {
// Deletion
if (step != 1) {
// For non-contiguous slices, delete from highest to lowest to maintain indices
std::vector<Py_ssize_t> indices;
for (Py_ssize_t i = 0, cur = start; i < slicelength; i++, cur += step) {
indices.push_back(cur);
}
// Sort in descending order
std::sort(indices.begin(), indices.end(), std::greater<Py_ssize_t>());
// Delete each index
for (Py_ssize_t idx : indices) {
auto it = self->data->begin();
std::advance(it, idx);
(*it)->grid = nullptr; // Clear grid reference
self->data->erase(it);
}
} else {
// Contiguous slice - delete range
auto it_start = self->data->begin();
auto it_stop = self->data->begin();
std::advance(it_start, start);
std::advance(it_stop, stop);
// Clear grid references
for (auto it = it_start; it != it_stop; ++it) {
(*it)->grid = nullptr;
}
self->data->erase(it_start, it_stop);
}
return 0;
} else {
// Assignment
if (!PySequence_Check(value)) {
PyErr_SetString(PyExc_TypeError, "can only assign sequence to slice");
return -1;
}
Py_ssize_t value_len = PySequence_Length(value);
if (value_len == -1) {
return -1;
}
// Validate all items first
std::vector<std::shared_ptr<UIEntity>> new_items;
for (Py_ssize_t i = 0; i < value_len; i++) {
PyObject* item = PySequence_GetItem(value, i);
if (!item) {
return -1;
}
// Type check
if (!PyObject_IsInstance(item, PyObject_GetAttrString(McRFPy_API::mcrf_module, "Entity"))) {
Py_DECREF(item);
PyErr_Format(PyExc_TypeError,
"EntityCollection can only contain Entity objects; "
"got %s at index %zd", Py_TYPE(item)->tp_name, i);
return -1;
}
PyUIEntityObject* entity = (PyUIEntityObject*)item;
Py_DECREF(item);
new_items.push_back(entity->data);
}
// Now perform the assignment
if (step == 1) {
// Contiguous slice
if (slicelength != value_len) {
// Need to resize - remove old items and insert new ones
auto it_start = self->data->begin();
auto it_stop = self->data->begin();
std::advance(it_start, start);
std::advance(it_stop, stop);
// Clear grid references from old items
for (auto it = it_start; it != it_stop; ++it) {
(*it)->grid = nullptr;
}
// Erase old range
it_start = self->data->erase(it_start, it_stop);
// Insert new items
for (const auto& entity : new_items) {
entity->grid = self->grid;
it_start = self->data->insert(it_start, entity);
++it_start;
}
} else {
// Same size, just replace
auto it = self->data->begin();
std::advance(it, start);
for (const auto& entity : new_items) {
(*it)->grid = nullptr; // Clear old grid ref
*it = entity;
entity->grid = self->grid; // Set new grid ref
++it;
}
}
} else {
// Extended slice
if (slicelength != value_len) {
PyErr_Format(PyExc_ValueError,
"attempt to assign sequence of size %zd to extended slice of size %zd",
value_len, slicelength);
return -1;
}
auto list_it = self->data->begin();
for (Py_ssize_t i = 0, cur = start; i < slicelength; i++, cur += step) {
auto cur_it = list_it;
std::advance(cur_it, cur);
(*cur_it)->grid = nullptr; // Clear old grid ref
*cur_it = new_items[i];
new_items[i]->grid = self->grid; // Set new grid ref
}
}
return 0;
}
} else {
PyErr_Format(PyExc_TypeError, "EntityCollection indices must be integers or slices, not %.200s",
Py_TYPE(key)->tp_name);
return -1;
}
}
PyMappingMethods UIEntityCollection::mpmethods = {
.mp_length = (lenfunc)UIEntityCollection::len,
.mp_subscript = (binaryfunc)UIEntityCollection::subscript,
.mp_ass_subscript = (objobjargproc)UIEntityCollection::ass_subscript
};
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
PyMethodDef UIEntityCollection::methods[] = {
{"append", (PyCFunction)UIEntityCollection::append, METH_O},
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
{"extend", (PyCFunction)UIEntityCollection::extend, METH_O},
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
{"remove", (PyCFunction)UIEntityCollection::remove, METH_O},
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
{"index", (PyCFunction)UIEntityCollection::index_method, METH_O},
{"count", (PyCFunction)UIEntityCollection::count, METH_O},
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
{NULL, NULL, 0, NULL}
};
PyObject* UIEntityCollection::repr(PyUIEntityCollectionObject* self)
{
std::ostringstream ss;
if (!self->data) ss << "<UICollection (invalid internal object)>";
else {
ss << "<UICollection (" << self->data->size() << " child objects)>";
}
std::string repr_str = ss.str();
return PyUnicode_DecodeUTF8(repr_str.c_str(), repr_str.size(), "replace");
}
int UIEntityCollection::init(PyUIEntityCollectionObject* self, PyObject* args, PyObject* kwds)
{
PyErr_SetString(PyExc_TypeError, "EntityCollection cannot be instantiated: a C++ data source is required.");
return -1;
}
PyObject* UIEntityCollection::iter(PyUIEntityCollectionObject* self)
{
Iterators, other Python C API improvements closes #72 ref #69 - this resolves the "UICollection" (not "UIEntityCollection", perhaps renamed since the issue opened) and "UIEntityCollection" portion. The Grid point based iterators were not updated. **RPATH updates** Will this RPATH setting allow McRogueFace to execute using its included "lib" subdirectory after being unzipped on a new computer? The change from "./lib" to "$ORIGIN/./lib" improves portability. The $ORIGIN token is a special Linux/Unix convention that refers to the directory containing the executable itself. This makes the path relative to the executable's location rather than the current working directory, which means McRogueFace will correctly find its libraries in the lib subdirectory regardless of where it's run from after being unzipped on a new computer. **New standard object initialization** PyColor, PyVector - Fixed all 15 PyTypeObject definitions to use proper designated initializer syntax - Replaced PyType_GenericAlloc usage in PyColor.cpp and PyVector.cpp - Updated PyObject_New usage in UIEntity.cpp - All object creation now uses module-based type lookups instead of static references - Created centralized utilities in PyObjectUtils.h **RAII Wrappers** automatic reference counting via C++ object lifecycle - Created PyRAII.h with PyObjectRef and PyTypeRef classes - These provide automatic reference counting management - Updated PyColor::from_arg() to demonstrate RAII usage - Prevents memory leaks and reference counting errors **Python object base in type defs:** `.ob_base = {.ob_base = {.ob_refcnt = 1, .ob_type = NULL}, .ob_size = 0}` PyColor, PyTexture, PyVector, UICaption, UICollection, UIEntity, UIFrame, UIGrid **convertDrawableToPython** replace crazy macro to detect the correct Python type of a UIDrawable instance - Removed the problematic macro from UIDrawable.h - Created template-based functions in PyObjectUtils.h - Updated UICollection.cpp to use local helper function - The new approach is cleaner, more debuggable, and avoids static type references **Iterator fixes** tp_iter on UICollection, UIGrid, UIGridPoint, UISprite UIGrid logic improved, standard **List vs Vector usage analysis** there are different use cases that weren't standardized: - UICollection (for Frame children) uses std::vector<std::shared_ptr<UIDrawable>> - UIEntityCollection (for Grid entities) uses std::list<std::shared_ptr<UIEntity>> The rationale is currently connected to frequency of expected changes. * A "UICollection" is likely either all visible or not; it's also likely to be created once and have a static set of contents. They should be contiguous in memory in hopes that this helps rendering speed. * A "UIEntityCollection" is expected to be rendered as a subset within the visible rectangle of the UIGrid. Scrolling the grid or gameplay logic is likely to frequently create and destroy entities. In general I expect Entity collections to have a much higher common size than UICollections. For these reasons I've made them Lists in hopes that they never have to be reallocated or moved during a frame.
2025-05-31 08:58:52 -04:00
// Get the iterator type from the module to ensure we have the registered version
PyTypeObject* iterType = (PyTypeObject*)PyObject_GetAttrString(McRFPy_API::mcrf_module, "UIEntityCollectionIter");
if (!iterType) {
PyErr_SetString(PyExc_RuntimeError, "Could not find UIEntityCollectionIter type in module");
return NULL;
}
// Allocate new iterator instance
PyUIEntityCollectionIterObject* iterObj = (PyUIEntityCollectionIterObject*)iterType->tp_alloc(iterType, 0);
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
if (iterObj == NULL) {
Iterators, other Python C API improvements closes #72 ref #69 - this resolves the "UICollection" (not "UIEntityCollection", perhaps renamed since the issue opened) and "UIEntityCollection" portion. The Grid point based iterators were not updated. **RPATH updates** Will this RPATH setting allow McRogueFace to execute using its included "lib" subdirectory after being unzipped on a new computer? The change from "./lib" to "$ORIGIN/./lib" improves portability. The $ORIGIN token is a special Linux/Unix convention that refers to the directory containing the executable itself. This makes the path relative to the executable's location rather than the current working directory, which means McRogueFace will correctly find its libraries in the lib subdirectory regardless of where it's run from after being unzipped on a new computer. **New standard object initialization** PyColor, PyVector - Fixed all 15 PyTypeObject definitions to use proper designated initializer syntax - Replaced PyType_GenericAlloc usage in PyColor.cpp and PyVector.cpp - Updated PyObject_New usage in UIEntity.cpp - All object creation now uses module-based type lookups instead of static references - Created centralized utilities in PyObjectUtils.h **RAII Wrappers** automatic reference counting via C++ object lifecycle - Created PyRAII.h with PyObjectRef and PyTypeRef classes - These provide automatic reference counting management - Updated PyColor::from_arg() to demonstrate RAII usage - Prevents memory leaks and reference counting errors **Python object base in type defs:** `.ob_base = {.ob_base = {.ob_refcnt = 1, .ob_type = NULL}, .ob_size = 0}` PyColor, PyTexture, PyVector, UICaption, UICollection, UIEntity, UIFrame, UIGrid **convertDrawableToPython** replace crazy macro to detect the correct Python type of a UIDrawable instance - Removed the problematic macro from UIDrawable.h - Created template-based functions in PyObjectUtils.h - Updated UICollection.cpp to use local helper function - The new approach is cleaner, more debuggable, and avoids static type references **Iterator fixes** tp_iter on UICollection, UIGrid, UIGridPoint, UISprite UIGrid logic improved, standard **List vs Vector usage analysis** there are different use cases that weren't standardized: - UICollection (for Frame children) uses std::vector<std::shared_ptr<UIDrawable>> - UIEntityCollection (for Grid entities) uses std::list<std::shared_ptr<UIEntity>> The rationale is currently connected to frequency of expected changes. * A "UICollection" is likely either all visible or not; it's also likely to be created once and have a static set of contents. They should be contiguous in memory in hopes that this helps rendering speed. * A "UIEntityCollection" is expected to be rendered as a subset within the visible rectangle of the UIGrid. Scrolling the grid or gameplay logic is likely to frequently create and destroy entities. In general I expect Entity collections to have a much higher common size than UICollections. For these reasons I've made them Lists in hopes that they never have to be reallocated or moved during a frame.
2025-05-31 08:58:52 -04:00
Py_DECREF(iterType);
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
return NULL; // Failed to allocate memory for the iterator object
}
iterObj->data = self->data;
iterObj->index = 0;
iterObj->start_size = self->data->size();
Iterators, other Python C API improvements closes #72 ref #69 - this resolves the "UICollection" (not "UIEntityCollection", perhaps renamed since the issue opened) and "UIEntityCollection" portion. The Grid point based iterators were not updated. **RPATH updates** Will this RPATH setting allow McRogueFace to execute using its included "lib" subdirectory after being unzipped on a new computer? The change from "./lib" to "$ORIGIN/./lib" improves portability. The $ORIGIN token is a special Linux/Unix convention that refers to the directory containing the executable itself. This makes the path relative to the executable's location rather than the current working directory, which means McRogueFace will correctly find its libraries in the lib subdirectory regardless of where it's run from after being unzipped on a new computer. **New standard object initialization** PyColor, PyVector - Fixed all 15 PyTypeObject definitions to use proper designated initializer syntax - Replaced PyType_GenericAlloc usage in PyColor.cpp and PyVector.cpp - Updated PyObject_New usage in UIEntity.cpp - All object creation now uses module-based type lookups instead of static references - Created centralized utilities in PyObjectUtils.h **RAII Wrappers** automatic reference counting via C++ object lifecycle - Created PyRAII.h with PyObjectRef and PyTypeRef classes - These provide automatic reference counting management - Updated PyColor::from_arg() to demonstrate RAII usage - Prevents memory leaks and reference counting errors **Python object base in type defs:** `.ob_base = {.ob_base = {.ob_refcnt = 1, .ob_type = NULL}, .ob_size = 0}` PyColor, PyTexture, PyVector, UICaption, UICollection, UIEntity, UIFrame, UIGrid **convertDrawableToPython** replace crazy macro to detect the correct Python type of a UIDrawable instance - Removed the problematic macro from UIDrawable.h - Created template-based functions in PyObjectUtils.h - Updated UICollection.cpp to use local helper function - The new approach is cleaner, more debuggable, and avoids static type references **Iterator fixes** tp_iter on UICollection, UIGrid, UIGridPoint, UISprite UIGrid logic improved, standard **List vs Vector usage analysis** there are different use cases that weren't standardized: - UICollection (for Frame children) uses std::vector<std::shared_ptr<UIDrawable>> - UIEntityCollection (for Grid entities) uses std::list<std::shared_ptr<UIEntity>> The rationale is currently connected to frequency of expected changes. * A "UICollection" is likely either all visible or not; it's also likely to be created once and have a static set of contents. They should be contiguous in memory in hopes that this helps rendering speed. * A "UIEntityCollection" is expected to be rendered as a subset within the visible rectangle of the UIGrid. Scrolling the grid or gameplay logic is likely to frequently create and destroy entities. In general I expect Entity collections to have a much higher common size than UICollections. For these reasons I've made them Lists in hopes that they never have to be reallocated or moved during a frame.
2025-05-31 08:58:52 -04:00
Py_DECREF(iterType);
Squashed commit of the following: [break_up_ui_h] Closes #43 No segfault found in cos_play after completing the checklist. Maybe I accidentally fixed it...? commit 6aa151aba33d676c7c1290467bb3c6360820c816 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:43:58 2024 -0400 UISprite.h/.cpp cleanup commit ec0374ef50ecbbcc48b9901d296dfa48d57605bd Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:37:39 2024 -0400 UIGridPoint.h/.cpp reorganization commit 2cb7339535990d91e5d256bca8533ec1c32bb11a Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 19 21:19:25 2024 -0400 UIGrid.h/.cpp cleanup. I have reservations about the UIEntityCollection[Iter] classes + methods living there, but not enough to fix it right now. commit 5d6af324bf2a6772a681a62b9dbe399b9c4c78d8 Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 22:14:57 2024 -0400 UIFrame - moving static method into class namespace; no type object access commit 567218cd7bb58c87fd980166010752a0e913ef2d Author: John McCardle <mccardle.john@gmail.com> Date: Thu Apr 18 21:23:49 2024 -0400 UIEntity fixes for the UI.h split: There are segfaults in cos_play, I may have missed a type usage or something commit 76693acd289a378a8a2dffe9e9657084d5db3ce3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:18:37 2024 -0400 delete leftover comments commit 9efe998a3396182b468969b9a495164bd95100a3 Author: John McCardle <mccardle.john@gmail.com> Date: Sat Apr 13 00:17:43 2024 -0400 some work on UICaption and UICollection; fixing segfaults resulting from mcrfpydef namepace TypeObject usage commit 714965da4544b8848306ad9b281f48b2378567a5 Author: John McCardle <mccardle.john@gmail.com> Date: Fri Apr 12 14:15:00 2024 -0400 eliminate extra includes on UICaption commit 8efa25878f8f2b3a670693bbe197af618d373360 Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:41:14 2024 -0400 remove a lot of stuff commit c186d8c7f301f216f46ea52c92d60d15615c45ff Author: John McCardle <mccardle.john@gmail.com> Date: Wed Apr 10 23:10:15 2024 -0400 We are compiling again! Started refactoring UICaption to be more idiomatic commit 1b6e2a709bfa3adc38183e30f1cc999efd7ef7c9 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:42:02 2024 -0400 Still not quite compiling; as predicted, a lot of interdependency and definition order bugs to untangle commit aa7553a81807b017c64fbf860e54cb48fc136243 Author: John McCardle <mccardle.john@gmail.com> Date: Tue Apr 9 22:41:20 2024 -0400 PyTexture clean up scribbles and experiments commit c0201d989acb2dbd25ae80f6642c4b849db0c0b5 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:55:00 2024 -0400 additional unsaved changes commit 83a63a3093d206fa2d00c7bf278b78de0a060b92 Author: John McCardle <mccardle.john@gmail.com> Date: Mon Apr 8 22:45:00 2024 -0400 doesn't compile, but UI.h/.cpp code has been divvy'd up. refs #43 @2h
2024-04-20 10:32:04 -04:00
return (PyObject*)iterObj;
}
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") {
box.setPosition(sf::Vector2f(value, box.getPosition().y));
output.setPosition(box.getPosition());
return true;
}
else if (name == "y") {
box.setPosition(sf::Vector2f(box.getPosition().x, value));
output.setPosition(box.getPosition());
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));
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));
return true;
}
else if (name == "center_x") {
center_x = value;
return true;
}
else if (name == "center_y") {
center_y = value;
return true;
}
else if (name == "zoom") {
zoom = value;
return true;
}
else if (name == "z_index") {
z_index = static_cast<int>(value);
return true;
}
return false;
}
bool UIGrid::setProperty(const std::string& name, const sf::Vector2f& value) {
if (name == "position") {
box.setPosition(value);
output.setPosition(box.getPosition());
return true;
}
else if (name == "size") {
box.setSize(value);
output.setTextureRect(sf::IntRect(0, 0, box.getSize().x, box.getSize().y));
return true;
}
else if (name == "center") {
center_x = value.x;
center_y = value.y;
return true;
}
return false;
}
bool UIGrid::getProperty(const std::string& name, float& value) const {
if (name == "x") {
value = box.getPosition().x;
return true;
}
else if (name == "y") {
value = box.getPosition().y;
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;
}
return false;
}
bool UIGrid::getProperty(const std::string& name, sf::Vector2f& value) const {
if (name == "position") {
value = box.getPosition();
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;
}