Go to file
John McCardle 4e94291cfb docs: Complete Phase 7 documentation system with parser fixes and man pages
Fixed critical documentation generation bugs and added complete multi-format
output support. All documentation now generates cleanly from MCRF_* macros.

## Parser Fixes (tools/generate_dynamic_docs.py)

Fixed parse_docstring() function:
- Added "Raises:" section support (was missing entirely)
- Fixed function name duplication in headings
  - Was: `createSoundBuffercreateSoundBuffer(...)`
  - Now: `createSoundBuffer(filename: str) -> int`
- Proper section separation between Returns and Raises
- Handles MCRF_* macro format correctly

Changes:
- Rewrote parse_docstring() to parse by section markers
- Fixed markdown generation (lines 514-539)
- Fixed HTML generation (lines 385-413, 446-473)
- Added "raises" field to parsed output dict

## Man Page Generation

New files:
- tools/generate_man_page.sh - Pandoc wrapper for man page generation
- docs/mcrfpy.3 - Unix man page (section 3 for library functions)

Uses pandoc with metadata:
- Section 3 (library functions)
- Git version tag in footer
- Current date in header

## Master Orchestration Script

New file: tools/generate_all_docs.sh

Single command generates all documentation formats:
- HTML API reference (docs/api_reference_dynamic.html)
- Markdown API reference (docs/API_REFERENCE_DYNAMIC.md)
- Unix man page (docs/mcrfpy.3)
- Type stubs (stubs/mcrfpy.pyi via generate_stubs_v2.py)

Includes error checking (set -e) and helpful output messages.

## Documentation Updates (CLAUDE.md)

Updated "Regenerating Documentation" section:
- Documents new ./tools/generate_all_docs.sh master script
- Lists all output files with descriptions
- Notes pandoc as system requirement
- Clarifies generate_stubs_v2.py is preferred (has @overload support)

## Type Stub Decision

Assessed generate_stubs.py vs generate_stubs_v2.py:
- generate_stubs.py has critical bugs (missing commas in method signatures)
- generate_stubs_v2.py produces high-quality manually-maintained stubs
- Decision: Keep v2, use it in master script

## Files Modified

Modified:
- CLAUDE.md (25 lines changed)
- tools/generate_dynamic_docs.py (121 lines changed)
- docs/api_reference_dynamic.html (359 lines changed)

Created:
- tools/generate_all_docs.sh (28 lines)
- tools/generate_man_page.sh (12 lines)
- docs/mcrfpy.3 (1070 lines)
- stubs/mcrfpy.pyi (532 lines)
- stubs/mcrfpy/__init__.pyi (213 lines)
- stubs/mcrfpy/automation.pyi (24 lines)
- stubs/py.typed (0 bytes)

Total: 2159 insertions, 225 deletions

## Testing

Verified:
- Man page viewable with `man docs/mcrfpy.3`
- No function name duplication in docs/API_REFERENCE_DYNAMIC.md
- Raises sections properly separated from Returns
- Master script successfully generates all formats

## Related Issues

Addresses requirements from Phase 7 documentation issues.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-30 21:20:50 -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
docs docs: Complete Phase 7 documentation system with parser fixes and man pages 2025-10-30 21:20:50 -04:00
modules Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
roguelike_tutorial fix: update child class property overrides to use MCRF_PROPERTY macros 2025-10-30 12:33:27 -04:00
src docs: Phase 3 - Convert 19 module functions to MCRF_FUNCTION macros 2025-10-30 19:38:22 -04:00
stubs docs: Complete Phase 7 documentation system with parser fixes and man pages 2025-10-30 21:20:50 -04:00
tests feat: Add comprehensive profiling system with F3 overlay 2025-10-25 00:45:44 -04:00
tools docs: Complete Phase 7 documentation system with parser fixes and man pages 2025-10-30 21:20:50 -04:00
.gitignore Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
.gitmodules Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
.mcp.json fix: update child class property overrides to use MCRF_PROPERTY macros 2025-10-30 12:33:27 -04:00
CLAUDE.md docs: Complete Phase 7 documentation system with parser fixes and man pages 2025-10-30 21:20:50 -04:00
CMakeLists.txt hotfix: Windows build, no longer console mode 2025-07-10 17:01:03 -04:00
GNUmakefile Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -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 docs: Complete wiki migration and issue labeling system 2025-10-25 20:54:55 -04:00
ROADMAP.md docs: Add Gitea-first workflow guidelines to project documentation 2025-10-25 00:56:21 -04:00
build.sh Squashed commit of the following: [alpha_streamline_1] 2025-07-05 18:56:02 -04:00
build_windows.bat hotfix: Windows build attempt 2025-07-09 23:33:09 -04:00
build_windows_cmake.bat Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
compile_commands.json Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
forgejo-mcp.linux.amd64 fix: update child class property overrides to use MCRF_PROPERTY macros 2025-10-30 12:33:27 -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.

  • Core roguelike logic from libtcod: field of view, pathfinding
  • Animate sprites with multiple frames. Smooth transitions for positions, sizes, zoom, and camera
  • Simple GUI element system allows keyboard and mouse input, composition
  • No compilation or installation necessary. The runtime is a full Python environment; "Zip And Ship"

 Image

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

Quick Start

Download:

  • The entire McRogueFace visual framework:
    • Sprite: an image file or one sprite from a shared sprite sheet
    • Caption: load a font, display text
    • Frame: A rectangle; put other things on it to move or manage GUIs as modules
    • Grid: A 2D array of tiles with zoom + position control
    • Entity: Lives on a Grid, displays a sprite, and can have a perspective or move along a path
    • Animation: Change any property on any of the above over time
# 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

📚 Developer Documentation

For comprehensive documentation about systems, architecture, and development workflows:

Project Wiki

Key wiki pages:

📖 Development Guides

In the repository root:

Build Requirements

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

Project Structure

McRogueFace/
├── assets/        # Sprites, fonts, audio
├── build/         # Build output directory: zip + ship
│   ├─ (*)assets/  # (copied location of assets) 
│   ├─ (*)scripts/ # (copied location of src/scripts)
│   └─ lib/        # SFML, TCOD libraries,  Python + standard library / modules
├── deps/          # Python, SFML, and libtcod imports can be tossed in here to build
│   └─ platform/   # windows, linux subdirectories for OS-specific cpython config
├── docs/          # generated HTML, markdown docs
│   └─ stubs/      # .pyi files for editor integration
├── modules/       # git submodules, to build all of McRogueFace's dependencies from source
├── src/           # C++ engine source
│   └─ scripts/    # Python game scripts (copied during build)
└── tests/         # Automated test suite
└── tools/         # For the McRogueFace ecosystem: docs generation

If you are building McRogueFace to implement game logic or scene configuration in C++, you'll have to compile the project.

If you are writing a game in Python using McRogueFace, you only need to rename and zip/distribute the build directory.

Philosophy

  • C++ every frame, Python every tick: All rendering data is handled in C++. Structure your UI and program animations in Python, and they are rendered without Python. All game logic can be written in Python.
  • No Compiling Required; Zip And Ship: Implement your game objects with Python, zip up McRogueFace with your "game.py" to ship
  • Built-in Roguelike Support: Dungeon generation, pathfinding, and field-of-view via libtcod
  • Hands-Off Testing: 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

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.

Issue Tracking

The project uses Gitea Issues for task tracking and bug reports. Issues are organized with labels:

  • System labels (grid, animation, python-binding, etc.) - identify which codebase area
  • Priority labels (tier1-active, tier2-foundation, tier3-future) - development timeline
  • Type labels (Major Feature, Minor Feature, Bugfix, etc.) - effort and scope

See the Issue Roadmap on the wiki for organized view of all open tasks.

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