feat(Grid): add customizable background_color property (#50)

- Added sf::Color background_color member with default dark gray
- Python property getter/setter for background_color
- Animation support for individual color components (r/g/b/a)
- Replaces hardcoded clear color in render method
- Test demonstrates color changes and property access

Closes #50
This commit is contained in:
John McCardle 2025-07-06 15:58:17 -04:00
commit ff7cf25806
20 changed files with 104 additions and 4 deletions

View file

@ -982,4 +982,41 @@ When the window was closed externally via the X button, the cleanup order was in
- Moved template functions and macros from `UIDrawable_methods.h` into `UIBase.h`
- Created `UIEntityPyMethods.h` for UIEntity-specific implementations
- Removed the now-unnecessary `UIDrawable_methods.h`
- Result: Better code organization with Python binding code in appropriate headers
- Result: Better code organization with Python binding code in appropriate headers
---
## Phase 6: Rendering Revolution
### Task: Grid Background Colors (#50)
**Status**: Completed
**Date**: 2025-07-06
**Goal**: Add background_color property to UIGrid for customizable grid backgrounds
**Implementation**:
1. Added `sf::Color background_color` member to UIGrid class
2. Initialized with default dark gray (8, 8, 8, 255) in constructors
3. Replaced hardcoded clear color with `renderTexture.clear(background_color)`
4. Added Python property getter/setter:
- `grid.background_color` returns Color object
- Can set with any Color object
5. Added animation support via property system:
- `background_color.r/g/b/a` can be animated individually
- Proper clamping to 0-255 range
**Technical Details**:
- Background renders before grid tiles and entities
- Animation support through existing property system
- Type-safe Color object validation
- No performance impact (just changes clear color)
**Test Results**:
- Default background color (8, 8, 8) works correctly
- Setting background_color property changes render
- Individual color components can be modified
- Color cycling demonstration successful
**Result**: Grid backgrounds are now customizable, allowing for themed dungeons, environmental effects, and visual polish. This was a perfect warm-up task for Phase 6.
---