Go to file
John McCardle 99f301e3a0 Add position tuple support and pos property to UI elements
closes #83, closes #84

- Issue #83: Add position tuple support to constructors
  - Frame and Sprite now accept both (x, y) and ((x, y)) forms
  - Also accept Vector objects as position arguments
  - Caption and Entity already supported tuple/Vector forms
  - Uses PyVector::from_arg for flexible position parsing

- Issue #84: Add pos property to Frame and Sprite
  - Added pos getter that returns a Vector
  - Added pos setter that accepts Vector or tuple
  - Provides consistency with Caption and Entity which already had pos properties
  - All UI elements now have a uniform way to get/set positions as Vectors

Both features improve API consistency and make it easier to work with positions.
2025-07-05 16:25:32 -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 Add position tuple support and pos property to UI elements 2025-07-05 16:25:32 -04:00
tests Add position tuple support and pos property to UI elements 2025-07-05 16:25:32 -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