Go to file
John McCardle e5affaf317 Fix critical issues: script loading, entity types, and color properties
- Issue #37: Fix Windows scripts subdirectory not checked
  - Updated executeScript() to use executable_path() from platform.h
  - Scripts now load correctly when working directory differs from executable

- Issue #76: Fix UIEntityCollection returns wrong type
  - Updated UIEntityCollectionIter::next() to check for stored Python object
  - Derived Entity classes now preserve their type when retrieved from collections

- Issue #9: Recreate RenderTexture when resized (already fixed)
  - Confirmed RenderTexture recreation already implemented in set_size() and set_float_member()
  - Uses 1.5x padding and 4096 max size limit

- Issue #79: Fix Color r, g, b, a properties return None
  - Implemented get_member() and set_member() in PyColor.cpp
  - Color component properties now work correctly with proper validation

- Additional fix: Grid.at() method signature
  - Changed from METH_O to METH_VARARGS to accept two arguments

All fixes include comprehensive tests to verify functionality.

closes #37, closes #76, closes #9, closes #79

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 15:50:09 -04:00
.archive Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
assets Whoops, never commited the UI icons spritesheet 2025-03-08 20:33:55 -05:00
deps/platform Windows build 2024-02-25 15:38:38 -05:00
modules Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
src Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
tests Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
.gitignore Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
.gitmodules Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
CMakeLists.txt Iterators, other Python C API improvements 2025-05-31 09:11:51 -04:00
GNUmakefile Squashed commit of the following: [interpreter_mode] 2025-07-05 12:04:20 -04:00
LICENSE.md Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
README.md Squashed commit of the following: [interpreter_mode] 2025-07-05 12:04:20 -04:00
_test.py Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
automation_example.py Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
automation_exec_examples.py Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
build.sh Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
clean.sh Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
compile_commands.json Squashed commit of the following: [interpreter_mode] 2025-07-05 12:04:20 -04:00
css_colors.txt Squashed commit of the following: [standardize_color_handling] 2024-03-30 21:20:40 -04:00
debug_immediate.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
debug_multi_0.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
debug_multi_1.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
debug_multi_2.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
example_automation.py Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
example_config.py Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
example_monitoring.py Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
exec_flag_implementation.cpp Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
generate_color_table.py Squashed commit of the following: [standardize_color_handling] 2024-03-30 21:20:40 -04:00
gitea_issues.py Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
grid_none_texture_test_197.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
issue78_fixed_1658.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
screenshot_opaque_fix_20250703_174829.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
timer_success_1086.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
validate_screenshot_basic_20250703_174532.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
validate_screenshot_final_20250703_174532.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
validate_screenshot_with_spaces 20250703_174532.png Fix critical issues: script loading, entity types, and color properties 2025-07-05 15:50:09 -04:00
wikicrayons_colors.txt Squashed commit of the following: [standardize_color_handling] 2024-03-30 21:20:40 -04:00
xkcd_colors.txt Squashed commit of the following: [standardize_color_handling] 2024-03-30 21:20:40 -04:00

README.md

McRogueFace

Blame my wife for the name

A Python-powered 2D game engine for creating roguelike games, built with C++ and SFML.

Pre-Alpha Release Demo: my 7DRL 2025 entry "Crypt of Sokoban" - a prototype with buttons, boulders, enemies, and items.

Tenets

  • Python & C++ Hand-in-Hand: Create your game without ever recompiling. Your Python commands create C++ objects, and animations can occur without calling Python at all.
  • Simple Yet Flexible UI System: Sprites, Grids, Frames, and Captions with full animation support
  • Entity-Component Architecture: Implement your game objects with Python integration
  • Built-in Roguelike Support: Dungeon generation, pathfinding, and field-of-view via libtcod (demos still under construction)
  • Automation API: PyAutoGUI-inspired event generation framework. All McRogueFace interactions can be performed headlessly via script: for software testing or AI integration
  • Interactive Development: Python REPL integration for live game debugging. Use mcrogueface like a Python interpreter

Quick Start

# Clone and build
git clone <wherever you found this repo>
cd McRogueFace
make

# Run the example game
cd build
./mcrogueface

Example: Creating a Simple Scene

import mcrfpy

# Create a new scene
mcrfpy.createScene("intro")

# Add a text caption
caption = mcrfpy.Caption((50, 50), "Welcome to McRogueFace!")
caption.size = 48 
caption.fill_color = (255, 255, 255)

# Add to scene
mcrfpy.sceneUI("intro").append(caption)

# Switch to the scene
mcrfpy.setScene("intro")

Documentation

For comprehensive documentation, tutorials, and API reference, visit: https://mcrogueface.github.io

Requirements

  • C++17 compiler (GCC 7+ or Clang 5+)
  • CMake 3.14+
  • Python 3.12+
  • SFML 2.5+
  • Linux or Windows (macOS untested)

Project Structure

McRogueFace/
├── src/           # C++ engine source
├── scripts/       # Python game scripts
├── assets/        # Sprites, fonts, audio
├── build/         # Build output directory
└── tests/         # Automated test suite

Contributing

PRs will be considered! Please include explicit mention that your contribution is your own work and released under the MIT license in the pull request.

The project has a private roadmap and issue list. Reach out via email or social media if you have bugs or feature requests.

License

This project is licensed under the MIT License - see LICENSE file for details.

Acknowledgments

  • Developed for 7-Day Roguelike 2023, 2024, 2025 - here's to many more
  • Built with SFML, libtcod, and Python
  • Inspired by David Churchill's COMP4300 game engine lectures