McRogueFace/src
John McCardle ff46043023 Add Game-to-API Bridge for external client integration
Implements a general-purpose HTTP API that exposes McRogueFace games
to external clients (LLMs, accessibility tools, Twitch integrations,
testing harnesses).

API endpoints:
- GET /scene - Full scene graph with all UI elements
- GET /affordances - Interactive elements with semantic labels
- GET /screenshot - PNG screenshot (binary or base64)
- GET /metadata - Game metadata for LLM context
- GET /wait - Long-poll for state changes
- POST /input - Inject clicks, keys, or affordance clicks

Key features:
- Automatic affordance detection from Frame+Caption+on_click patterns
- Label extraction from caption text with fallback to element.name
- Thread-safe scene access via mcrfpy.lock()
- Fuzzy label matching for click_affordance
- Full input injection via mcrfpy.automation

Usage: from api import start_server; start_server(8765)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 23:08:26 -05:00
..
scripts Add Game-to-API Bridge for external client integration 2026-01-29 23:08:26 -05:00
ActionCode.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
Animation.cpp Animation callbacks now pass (target, property, value) instead of (None, None) 2026-01-28 17:35:47 -05:00
Animation.h long -> intptr_t for casts. WIP: mingw cross-compilation for Windows (see #162) 2026-01-08 10:41:24 -05:00
BenchmarkLogger.cpp feat: Add work_time_ms to benchmark logging for load analysis 2025-11-28 16:13:40 -05:00
BenchmarkLogger.h feat: Add work_time_ms to benchmark logging for load analysis 2025-11-28 16:13:40 -05:00
CommandLineParser.cpp feat: Migrate to Python 3.14 (closes #135) 2025-11-26 17:48:12 -05:00
CommandLineParser.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
Common.h HeightMap: add GRID_MAX limit and input validation 2026-01-11 20:26:04 -05:00
GameEngine.cpp Shaders 2026-01-25 21:04:01 -05:00
GameEngine.h Shaders 2026-01-25 21:04:01 -05:00
GridChunk.cpp Remove YAGNI methods from performance systems 2026-01-09 15:40:13 -05:00
GridChunk.h Remove YAGNI methods from performance systems 2026-01-09 15:40:13 -05:00
GridLayers.cpp Add input validation and fix Entity repr 2026-01-16 19:18:27 -05:00
GridLayers.h Grid layers: add HeightMap-based procedural generation methods 2026-01-11 22:35:44 -05:00
HeadlessRenderer.cpp Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
HeadlessRenderer.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
ImGuiConsole.cpp Add ImGui Scene Explorer (F4) for runtime object inspection (#136) 2026-01-21 23:26:33 -05:00
ImGuiConsole.h imgui console: use JetBrains (redistributable font); use font size, not pixel scaling 2026-01-20 21:59:13 -05:00
ImGuiSceneExplorer.cpp Add ImGui Scene Explorer (F4) for runtime object inspection (#136) 2026-01-21 23:26:33 -05:00
ImGuiSceneExplorer.h Add ImGui Scene Explorer (F4) for runtime object inspection (#136) 2026-01-21 23:26:33 -05:00
IndexTexture.cpp Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
IndexTexture.h Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
main.cpp mingw toolchain and final fixes for Windows. Closes #162 2026-01-08 21:16:27 -05:00
McRFPy_API.cpp Shaders 2026-01-25 21:04:01 -05:00
McRFPy_API.h Fix #215: Replace mcrfpy.libtcod with mcrfpy.bresenham() 2026-01-20 00:10:13 -05:00
McRFPy_Automation.cpp Positions are always mcrfpy.Vector, Vector/tuple/iterables expected as inputs, and for position-only inputs we permit x,y args to prevent requiring double-parens 2026-01-05 10:16:16 -05:00
McRFPy_Automation.h Positions are always mcrfpy.Vector, Vector/tuple/iterables expected as inputs, and for position-only inputs we permit x,y args to prevent requiring double-parens 2026-01-05 10:16:16 -05:00
McRFPy_Doc.h feat: add documentation macro system header 2025-10-30 11:16:44 -04:00
McRogueFaceConfig.h feat: Exit on first Python callback exception (closes #133) 2025-11-26 10:26:30 -05:00
McRogueFaceVersion.h Version bump: 0.2.2-prerelease-7drl2026 (9a241c9) -> 0.2.3-prerelease-7drl2026 2026-01-23 22:07:53 -05:00
Profiler.cpp feat: Add comprehensive profiling system with F3 overlay 2025-10-25 00:45:44 -04:00
Profiler.h feat: Add comprehensive profiling system with F3 overlay 2025-10-25 00:45:44 -04:00
ProfilerOverlay.cpp feat: Add comprehensive profiling system with F3 overlay 2025-10-25 00:45:44 -04:00
PyAlignment.cpp Alignment: reactive or automatically calculated repositioning of UIDrawables on their parent 2026-01-13 20:40:34 -05:00
PyAlignment.h Alignment: reactive or automatically calculated repositioning of UIDrawables on their parent 2026-01-13 20:40:34 -05:00
PyAnimation.cpp long -> intptr_t for casts. WIP: mingw cross-compilation for Windows (see #162) 2026-01-08 10:41:24 -05:00
PyAnimation.h Animation fixes: 0-duration edge case, integer value bug resolution 2026-01-04 00:45:16 -05:00
PyBSP.cpp BSP: add room adjacency graph for corridor generation (closes #210) 2026-01-12 23:43:57 -05:00
PyBSP.h BSP: add room adjacency graph for corridor generation (closes #210) 2026-01-12 23:43:57 -05:00
PyCallable.cpp Add MouseButton.MIDDLE, SCROLL_UP, SCROLL_DOWN support 2026-01-28 23:22:16 -05:00
PyCallable.h Simplify on_enter/on_exit callbacks to position-only signature 2026-01-28 17:36:02 -05:00
PyColor.cpp hashing bugfix: '<<' rather than '<<=' operator was used 2026-01-09 13:45:36 -05:00
PyColor.h Animation fixes: 0-duration edge case, integer value bug resolution 2026-01-04 00:45:16 -05:00
PyDrawable.cpp Fix borrowed reference return in some callbacks 2026-01-27 10:43:10 -05:00
PyDrawable.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyEasing.cpp Easing functions as enum 2026-01-04 12:59:28 -05:00
PyEasing.h Easing functions as enum 2026-01-04 12:59:28 -05:00
PyFont.cpp docs: convert Phase 1 classes to documentation macros (Color, Font, Texture, Timer) 2025-10-30 16:59:40 -04:00
PyFont.h Squashed commit of the following: [alpha_streamline_1] 2025-07-05 18:56:02 -04:00
PyFOV.cpp feat: Implement FOV enum and layer draw_fov for #114 and #113 2025-12-01 15:18:10 -05:00
PyFOV.h feat: Implement FOV enum and layer draw_fov for #114 and #113 2025-12-01 15:18:10 -05:00
PyHeightMap.cpp libtcod experiments. Following feature branch API 2026-01-23 20:48:46 -05:00
PyHeightMap.h libtcod experiments. Following feature branch API 2026-01-23 20:48:46 -05:00
PyInputState.cpp Input Enums instead of strings. 2026-01-10 21:31:20 -05:00
PyInputState.h Input Enums instead of strings. 2026-01-10 21:31:20 -05:00
PyKey.cpp Input Enums instead of strings. 2026-01-10 21:31:20 -05:00
PyKey.h Input Enums instead of strings. 2026-01-10 21:31:20 -05:00
PyKeyboard.cpp feat: Add Sound/Music classes, keyboard state, version (#66, #160, #164) 2025-12-29 16:24:27 -05:00
PyKeyboard.h feat: Add Sound/Music classes, keyboard state, version (#66, #160, #164) 2025-12-29 16:24:27 -05:00
PyLock.cpp Fix #219: Add threading support with mcrfpy.lock() context manager 2026-01-19 23:37:49 -05:00
PyLock.h Fix #219: Add threading support with mcrfpy.lock() context manager 2026-01-19 23:37:49 -05:00
PyMouse.cpp mcrfpy.Mouse: a new class built for symmetry with mcrfpy.Keyboard. Closes #186 2026-01-06 21:39:01 -05:00
PyMouse.h mcrfpy.Mouse: a new class built for symmetry with mcrfpy.Keyboard. Closes #186 2026-01-06 21:39:01 -05:00
PyMouseButton.cpp Add MouseButton.MIDDLE, SCROLL_UP, SCROLL_DOWN support 2026-01-28 23:22:16 -05:00
PyMouseButton.h Input Enums instead of strings. 2026-01-10 21:31:20 -05:00
PyMusic.cpp feat: Add Sound/Music classes, keyboard state, version (#66, #160, #164) 2025-12-29 16:24:27 -05:00
PyMusic.h feat: Add Sound/Music classes, keyboard state, version (#66, #160, #164) 2025-12-29 16:24:27 -05:00
PyNoiseSource.cpp Noise, combination, and sampling: first pass at #207, #208, #194, #209 2026-01-12 19:01:20 -05:00
PyNoiseSource.h Noise, combination, and sampling: first pass at #207, #208, #194, #209 2026-01-12 19:01:20 -05:00
PyObjectUtils.h Iterators, other Python C API improvements 2025-05-31 09:11:51 -04:00
PyPositionHelper.h Positions are always mcrfpy.Vector, Vector/tuple/iterables expected as inputs, and for position-only inputs we permit x,y args to prevent requiring double-parens 2026-01-05 10:16:16 -05:00
PyRAII.h Iterators, other Python C API improvements 2025-05-31 09:11:51 -04:00
PyScene.cpp Add MouseButton.MIDDLE, SCROLL_UP, SCROLL_DOWN support 2026-01-28 23:22:16 -05:00
PyScene.h feat: Implement comprehensive mouse event system 2025-11-27 23:08:31 -05:00
PySceneObject.cpp cell, scene callbacks support for derived classes + enum args 2026-01-27 22:38:37 -05:00
PySceneObject.h emove register_keyboard(callable) from scene - all callbacks are standard attributes now. on_resize now returns a vector 2026-01-17 23:38:24 -05:00
PyShader.cpp Shaders 2026-01-25 21:04:01 -05:00
PyShader.h Shaders 2026-01-25 21:04:01 -05:00
PySound.cpp feat: Add Sound/Music classes, keyboard state, version (#66, #160, #164) 2025-12-29 16:24:27 -05:00
PySound.h feat: Add Sound/Music classes, keyboard state, version (#66, #160, #164) 2025-12-29 16:24:27 -05:00
PyTexture.cpp feat: Implement texture caching system with dirty flag optimization (closes #144) 2025-11-28 19:30:24 -05:00
PyTexture.h feat: Implement texture caching system with dirty flag optimization (closes #144) 2025-11-28 19:30:24 -05:00
PythonObjectCache.cpp Replace deprecated PyWeakref_GetObject with PyWeakref_GetRef (closes #191) 2026-01-11 20:48:06 -05:00
PythonObjectCache.h Squashed commit of the following: [alpha_presentable] 2025-07-15 21:30:49 -04:00
PyTimer.cpp Modernize Crypt of Sokoban demo game and fix timer segfault 2026-01-21 23:47:46 -05:00
PyTimer.h Timer refactor: stopwatch-like semantics, mcrfpy.timers collection closes #173 2026-01-03 22:09:18 -05:00
PyTransition.cpp scene transitions via Scene object 2026-01-03 13:53:18 -05:00
PyTransition.h scene transitions via Scene object 2026-01-03 13:53:18 -05:00
PyTypeCache.cpp Grid code quality improvements 2026-01-10 08:37:31 -05:00
PyTypeCache.h Grid code quality improvements 2026-01-10 08:37:31 -05:00
PyUniformBinding.cpp Shaders 2026-01-25 21:04:01 -05:00
PyUniformBinding.h Shaders 2026-01-25 21:04:01 -05:00
PyUniformCollection.cpp Shaders 2026-01-25 21:04:01 -05:00
PyUniformCollection.h Shaders 2026-01-25 21:04:01 -05:00
PyVector.cpp hashing bugfix: '<<' rather than '<<=' operator was used 2026-01-09 13:45:36 -05:00
PyVector.h feat: Add Vector convenience features - indexing, tuple comparison, floor 2025-11-26 09:37:14 -05:00
PyWindow.cpp docs: convert Phase 2 classes to documentation macros (Animation, Window, SceneObject) 2025-10-30 17:03:28 -04:00
PyWindow.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
Resources.cpp Adding text functionality to Caption (why was that missing???) 2024-03-07 12:35:07 -05:00
Resources.h Adding text functionality to Caption (why was that missing???) 2024-03-07 12:35:07 -05:00
Scene.cpp feat: Implement Phase A UI hierarchy foundations (closes #122, #102, #116, #118) 2025-11-27 16:33:17 -05:00
Scene.h feat: Implement Phase A UI hierarchy foundations (closes #122, #102, #116, #118) 2025-11-27 16:33:17 -05:00
SceneTransition.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
SceneTransition.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
SpatialHash.cpp Remove YAGNI methods from performance systems 2026-01-09 15:40:13 -05:00
SpatialHash.h Remove YAGNI methods from performance systems 2026-01-09 15:40:13 -05:00
Timer.cpp timer fixes: timers managed by engine can run in the background. Closes #180 2026-01-06 20:13:51 -05:00
Timer.h timer fixes: timers managed by engine can run in the background. Closes #180 2026-01-06 20:13:51 -05:00
UI.h Squashed commit of the following: [break_up_ui_h] 2024-04-20 10:32:04 -04:00
UIArc.cpp Rotation 2026-01-25 23:20:52 -05:00
UIArc.h Fix: Derivable drawable types participate in garbage collector cycle detection 2026-01-27 13:21:10 -05:00
UIBase.h Rotation 2026-01-25 23:20:52 -05:00
UICaption.cpp Rotation 2026-01-25 23:20:52 -05:00
UICaption.h Fix: Derivable drawable types participate in garbage collector cycle detection 2026-01-27 13:21:10 -05:00
UICircle.cpp Rotation 2026-01-25 23:20:52 -05:00
UICircle.h Fix: Derivable drawable types participate in garbage collector cycle detection 2026-01-27 13:21:10 -05:00
UICollection.cpp Add ImGui Scene Explorer (F4) for runtime object inspection (#136) 2026-01-21 23:26:33 -05:00
UICollection.h Python API improvements: Vectors, bounds, window singleton, hidden types 2026-01-05 23:00:48 -05:00
UIDrawable.cpp Simplify on_enter/on_exit callbacks to position-only signature 2026-01-28 17:36:02 -05:00
UIDrawable.h Simplify on_enter/on_exit callbacks to position-only signature 2026-01-28 17:36:02 -05:00
UIEntity.cpp Shaders 2026-01-25 21:04:01 -05:00
UIEntity.h bugfixes for .parent property - partial #183 solution 2026-01-06 10:21:50 -05:00
UIEntityCollection.cpp Add ImGui Scene Explorer (F4) for runtime object inspection (#136) 2026-01-21 23:26:33 -05:00
UIEntityCollection.h Grid code quality improvements 2026-01-10 08:37:31 -05:00
UIEntityPyMethods.h Shaders 2026-01-25 21:04:01 -05:00
UIFrame.cpp Rotation 2026-01-25 23:20:52 -05:00
UIFrame.h Fix: Derivable drawable types participate in garbage collector cycle detection 2026-01-27 13:21:10 -05:00
UIGrid.cpp Fix UIGrid RenderTexture sizing - use game resolution instead of hard-coded 1080p 2026-01-28 17:35:34 -05:00
UIGrid.h Fix UIGrid RenderTexture sizing - use game resolution instead of hard-coded 1080p 2026-01-28 17:35:34 -05:00
UIGridPathfinding.cpp Djikstra to Heightmap: convert pathfinding data into a heightmap for use in procedural generation processes 2026-01-13 20:41:23 -05:00
UIGridPathfinding.h Djikstra to Heightmap: convert pathfinding data into a heightmap for use in procedural generation processes 2026-01-13 20:41:23 -05:00
UIGridPoint.cpp long -> intptr_t for casts. WIP: mingw cross-compilation for Windows (see #162) 2026-01-08 10:41:24 -05:00
UIGridPoint.h Python API improvements: Vectors, bounds, window singleton, hidden types 2026-01-05 23:00:48 -05:00
UILine.cpp Rotation 2026-01-25 23:20:52 -05:00
UILine.h Fix: Derivable drawable types participate in garbage collector cycle detection 2026-01-27 13:21:10 -05:00
UISprite.cpp Rotation 2026-01-25 23:20:52 -05:00
UISprite.h Fix: Derivable drawable types participate in garbage collector cycle detection 2026-01-27 13:21:10 -05:00
UITestScene.cpp refactor: Remove layer-related GridPoint properties, fix layer z-index 2025-11-28 23:21:39 -05:00
UITestScene.h Refactor: remove "s" prefix from "sRender" method ( -> "render") Closes #44 2024-04-20 14:16:14 -04:00