Commit Graph

14 Commits

Author SHA1 Message Date
John McCardle 70cf44f8f0 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.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 00:56:42 -04:00
John McCardle 05bddae511 Update comprehensive documentation for Alpha release (Issue #47)
- Completely rewrote README.md to reflect 7DRL 2025 success and 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

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-04 06:59:02 -04:00
John McCardle 0d26d51bc3 Compress ROADMAP.md and archive completed test files
- Condensed 'Today's Achievements' section for clarity
- Archived 9 completed test files from bug fixing session
- Updated task completion status for issues fixed today
- Identified 5 remaining Alpha blockers as next priority

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-03 23:05:30 -04:00
John McCardle 281800cd23 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.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-03 21:43:22 -04:00
John McCardle cb0130b46e 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
2025-07-03 21:09:06 -04:00
John McCardle 1e7f5e9e7e 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
2025-07-03 21:05:47 -04:00
John McCardle 923350137d 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().
2025-07-03 21:02:14 -04:00
John McCardle 6134869371 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.
2025-07-03 20:41:03 -04:00
John McCardle 4715356b5e 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.
2025-07-03 20:31:36 -04:00
John McCardle 6dd1cec600 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.
2025-07-03 20:27:32 -04:00
John McCardle f82b861bcd 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
2025-07-03 19:48:33 -04:00
John McCardle 59e6f8d53d 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
2025-07-03 19:42:32 -04:00
John McCardle 1c71d8d4f7 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
2025-07-03 19:40:42 -04:00
John McCardle 18cfe93a44 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.
2025-07-03 19:25:49 -04:00