Library

A gallery of runnable examples for McRogueFace: bite-sized playground snippets, full engine demo screens, and games. Source links are pinned to specific commits so they keep working as the code evolves.

Snippets pinned to site b3819c0 (McRogueFace/mcrogueface.github.io); demos/games pinned to engine b6720f6 (jmccardle/McRogueFace). Generated by tools/build_library.py.

Playground Snippets

130 focused, copy-paste examples covering the whole mcrfpy API. Each snippet fills the 1024x768 playground canvas.

Open in playground: the playground accepts shared code via an LZString-compressed #src= URL fragment or a #gist= id, but there is no by-URL loader to open a repo snippet directly. Copy the source below and paste it into the editor, then press Run (Ctrl+Enter).

Hello

# Snippet Objects Status Source
001 Hello Frame
Hello Frame - The simplest UI element
Scene, Frame, Color ✅ ok view · raw
002 Hello Caption
Hello Caption - Display text on screen
Scene, Caption, Color ✅ ok view · raw
003 Hello Sprite
Hello Sprite - Display a textured sprite
Scene, Sprite, Caption ✅ ok view · raw
004 Hello Grid
Hello Grid - Create a tile-based grid
Scene, Grid ✅ ok view · raw
005 Hello Entity
Hello Entity - Add entities to a grid
Scene, Grid, Entity ✅ ok view · raw

Frame

# Snippet Objects Status Source
006 Frame Colors
Frame Colors - Fill and outline colors
Scene, Frame, Color, Caption ✅ ok view · raw
007 Frame Opacity
Frame Opacity - Transparency levels
Scene, Frame, Color, Caption ✅ ok view · raw
008 Frame Outline
Frame Outline - Border thickness
Scene, Frame, Color, Caption ✅ ok view · raw
009 Frame Children
Frame Children - Nested UI elements
Scene, Frame, Color, Caption ✅ ok view · raw
010 Frame Clip Children
Frame Clipping - clip_children property
Scene, Frame, Color, Caption ✅ ok view · raw
011 Frame Z Index
Frame Z-Index - Control rendering order
Scene, Frame, Color, Caption ✅ ok view · raw
012 Frame Visible
Frame Visibility - Show and hide elements
Scene, Frame, Color, Caption ✅ ok view · raw
013 Frame Name
Frame Name - Named elements for lookup
Scene, Frame, Color, find, Caption ✅ ok view · raw
014 Frame Rotation
Frame Rotation - Rotate UI elements
Scene, Frame, Color, Caption ✅ ok view · raw
015 Frame Origin
Frame Origin - Rotation pivot point
Scene, Frame, Color, Vector, Caption ✅ ok view · raw
016 Frame Alignment
Frame Alignment - Automatic positioning
Scene, Frame, Color, Alignment ✅ ok view · raw

Caption

# Snippet Objects Status Source
017 Caption Styling
Caption Styling - Text colors and fonts
Scene, Caption, Color ✅ ok view · raw
018 Caption In Frame
Caption in Frame - Text inside containers
Scene, Frame, Color, Caption ✅ ok view · raw
019 Caption Dimensions
Caption Dimensions - Text width and height
Scene, Caption, Color, Frame ✅ ok view · raw

Sprite

# Snippet Objects Status Source
020 Sprite Atlas
Sprite Atlas - Browse texture atlas
Scene, Caption, Color, Sprite ✅ ok view · raw
021 Sprite Scale
Sprite Scale - Resize sprites
Caption, Color, Scene, Sprite ✅ ok view · raw
022 Sprite Tint
Sprite Tint - Note: Sprite tinting requires shader
Caption, Color, Scene, Sprite ✅ ok view · raw
124 Sprite Rotation
Sprite Rotation - Rotate sprite images
Caption, Color, Frame, Scene, Sprite ✅ ok view · raw

Grid

# Snippet Objects Status Source
023 Grid Tiles
Grid Tiles - Different tile types
Grid, Scene ✅ ok view · raw
024 Grid Walkable
Grid Walkable - Walkable vs blocked tiles
Caption, Color, Grid, Scene ✅ ok view · raw
025 Grid Cell Color
Grid Cell Colors - Use color layer for cell colors
Caption, Color, ColorLayer, Grid, Scene ✅ ok view · raw
026 Grid Camera Center
Grid Camera Center - Pan the view
Caption, Color, Entity, Grid, InputState, Key, Scene ✅ ok view · raw
027 Grid Zoom
Grid Zoom - Scale the grid view
Caption, Color, Entity, Frame, Grid, Scene ✅ ok view · raw
083 Grid Layers
Grid Layers - Multiple tile layers
Caption, Color, ColorLayer, Grid, Scene, TileLayer ✅ ok view · raw
087 Grid Point State
Grid Point State - Cell properties
Caption, Color, ColorLayer, Grid, InputState, Scene ✅ ok view · raw
098 Grid Fill Color
Grid Fill Color - Background color
Caption, Color, Entity, Frame, Grid, Scene ✅ ok view · raw
101 Grid Camera Rotation
Grid Camera Rotation - Rotate the view
Caption, Color, Entity, Grid, InputState, Key, Scene, current_scene, default_texture ✅ ok view · raw
127 Grid Size
Grid Display Size - Viewport dimensions
Caption, Color, Entity, Frame, Grid, Scene ✅ ok view · raw

Entity

# Snippet Objects Status Source
028 Entity Movement
Entity Movement - Move entities on grid
Caption, Color, Entity, Grid, InputState, Key, Scene ✅ ok view · raw
029 Entity Multiple
Multiple Entities - Several entities on one grid
Caption, Color, Entity, Grid, Scene ✅ ok view · raw
030 Entity Draw Pos
Entity Draw Position - Smooth sub-tile positioning
Caption, Color, Entity, Grid, Scene, Timer, Vector ran view · raw
068 Entity Collection
Entity Collection - Manage grid entities
Scene, Grid, Entity, Caption, Color ✅ ok view · raw
085 Entity Visibility
Entity Visibility - Check what entities can see
Caption, Color, Entity, Grid, Scene, Timer ran view · raw
094 Entity Die
Entity Die - Remove entity from grid
Caption, Color, Entity, Grid, InputState, Key, Scene ✅ ok view · raw
095 Entity Index
Entity Index - Get entity position in collection
Caption, Color, Entity, Grid, InputState, Scene ✅ ok view · raw
121 Entity At
Entity At - Query entity’s view of grid
Caption, Color, Entity, Grid, InputState, Scene ✅ ok view · raw

Animation

# Snippet Objects Status Source
031 Animation Basic
Animation Basic - Animate position
Scene, Frame, Color, Caption, Key, InputState, Easing, Timer ran view · raw
032 Animation Easing Linear
Easing: LINEAR - Constant speed
Scene, Frame, Color, Caption, Easing, Timer ran view · raw
033 Animation Easing Ease In
Easing: EASE_IN - Slow start, fast end
Scene, Frame, Color, Caption, Easing, Timer ran view · raw
034 Animation Easing Ease Out
Easing: EASE_OUT - Fast start, slow end
Scene, Frame, Color, Caption, Easing, Timer ran view · raw
035 Animation Easing Ease In Out
Easing: EASE_IN_OUT - Smooth both ends
Scene, Frame, Color, Caption, Easing, Timer ran view · raw
036 Animation Easing Bounce
Easing: BOUNCE - Bouncy effect
Scene, Frame, Color, Caption, Easing, Timer ran view · raw
037 Animation Easing Elastic
Easing: ELASTIC - Springy overshoot
Scene, Frame, Color, Caption, Easing, Timer ran view · raw
038 Animation Easing Back
Easing: BACK - Anticipation/overshoot
Scene, Frame, Color, Caption, Easing, Timer ran view · raw
039 Animation Easing Comparison
Easing Comparison - Multiple easings side by side
Scene, Frame, Color, Caption, Easing, Timer ran view · raw
040 Animation Color
Animation Color - Animate fill_color
Scene, Frame, Color, Caption, Easing, Timer ran view · raw
041 Animation Opacity
Animation Opacity - Fade in/out
Caption, Color, Easing, Frame, Scene, Timer ran view · raw
042 Animation Size
Animation Size - Grow and shrink
Caption, Color, Easing, Frame, Scene, Timer ran view · raw
043 Animation Sprite Index
Animation Sprite Index - Sprite animation
Caption, Color, Easing, Frame, Scene, Sprite, Timer ran view · raw
044 Animation Callback
Animation Callback - Run code when animation ends
Caption, Color, Easing, Frame, Scene, Timer ran view · raw
045 Animation Chain
Animation Chain - Sequential animations
Caption, Color, Easing, Frame, Scene, Timer ran view · raw
088 Animation Multiple
Animation Multiple - Several animations at once
Caption, Color, Easing, Frame, Scene, Timer ran view · raw
103 Animation Pos Vector
Animation Position - Animate x and y along a path
Caption, Color, Easing, Frame, Scene, Timer, current_scene ran view · raw
112 Animation Delta
Animation Delta - Relative animation
Animation, Caption, Color, Easing, Frame, InputState, Key, Scene ✅ ok view · raw
120 Animation Complete
Animation Complete Check - Monitor animation state
Animation, Caption, Color, Easing, Frame, InputState, Key, Scene, Timer ran view · raw
123 Animation Stop
Animation Stop/Complete - Control running animations
Caption, Color, Easing, Frame, InputState, Key, Scene ✅ ok view · raw

Timer

# Snippet Objects Status Source
046 Timer Basic
Timer Basic - Periodic callback
Caption, Color, Frame, Scene, Timer ran view · raw
047 Timer Once
Timer Once - Single-shot timer
Caption, Color, Frame, Scene, Timer ran view · raw
048 Timer Control
Timer Control - Pause, resume, stop
Caption, Color, Frame, InputState, Key, Scene, Timer ran view · raw
096 Timer Remaining
Timer Remaining - Check time until next tick
Caption, Color, Frame, Scene, Timer ran view · raw
126 Timer Restart
Timer Restart - Reset and start timer
Caption, Color, Frame, InputState, Key, Scene, Timer ran view · raw

Input

# Snippet Objects Status Source
049 Input Keyboard
Input Keyboard - Key press handling
Caption, Color, Frame, InputState, Scene ✅ ok view · raw
050 Input Mouse Click
Input Mouse Click - Click on frames
Caption, Color, Frame, InputState, Scene ✅ ok view · raw
051 Input Mouse Hover
Input Mouse Hover - Enter/exit/move events
Scene, Frame, Color, Caption ✅ ok view · raw
052 Input Grid Cell Click
Input Grid Cell Click - Click on grid cells
Scene, Grid, Color, ColorLayer, Caption, InputState ✅ ok view · raw
053 Input Grid Cell Hover
Input Grid Cell Hover - Hover over grid cells
Scene, Grid, Color, ColorLayer, Caption ✅ ok view · raw

Pathfinding

# Snippet Objects Status Source
054 Pathfinding Astar
Pathfinding A* - Find path between points
Scene, Grid, Color, ColorLayer, Caption ✅ ok view · raw
055 Pathfinding Entity
Entity Pathfinding - Entity path_to method
Scene, Grid, Color, ColorLayer, Entity, Caption ✅ ok view · raw
056 Pathfinding Dijkstra
Dijkstra Map - Distance-based pathfinding
Scene, Grid, Color, ColorLayer, Caption ✅ ok view · raw

Fov

# Snippet Objects Status Source
057 Fov Basic
FOV Basic - Field of view computation
Scene, Grid, Color, ColorLayer, Entity, Caption ✅ ok view · raw
058 Fov Algorithms
FOV Algorithms - Compare different algorithms
Scene, Frame, Color, FOV, Grid, ColorLayer, Caption ✅ ok view · raw
059 Fov Perspective
FOV Perspective Entity - View from entity’s perspective
Scene, Grid, Color, Entity, Key, InputState, Caption ✅ ok view · raw

Bsp

# Snippet Objects Status Source
060 Bsp Basic
BSP Basic - Binary space partition for dungeon generation
Scene, Grid, Color, ColorLayer, BSP, Caption ✅ ok view · raw
102 Bsp Traversal
BSP Traversal - Different traversal orders
BSP, Caption, Color, ColorLayer, Frame, Grid, Scene, Traversal, current_scene, default_texture ✅ ok view · raw

Scene

# Snippet Objects Status Source
061 Scene Switching
Scene Switching - Multiple scenes
Scene, Frame, Caption, Color, Key, InputState ✅ ok view · raw
062 Scene Transition Fade
Scene Transition Fade - Smooth scene transitions
Scene, Frame, Caption, Color, Transition ✅ ok view · raw
063 Scene Transition Slide
Scene Transition Slide - Sliding transitions
Scene, Frame, Caption, Color, Transition ✅ ok view · raw
090 Scene Lifecycle
Scene Lifecycle - on_enter/on_exit callbacks
Caption, Color, Frame, InputState, Key, Scene ✅ ok view · raw
099 Scene Pos
Scene Position - Offset all scene content
Caption, Color, Frame, InputState, Key, Scene, Vector ✅ ok view · raw
129 Scene Update
Scene Update - Per-frame update method
Caption, Color, Frame, Scene ✅ ok view · raw

Vector

# Snippet Objects Status Source
064 Vector Basics
Vector Basics - 2D vector operations
Scene, Frame, Color, Vector, Caption ✅ ok view · raw
125 Vector Normalized
Vector Normalized - Unit vectors
Caption, Color, Frame, Scene, Vector ✅ ok view · raw

Color

# Snippet Objects Status Source
065 Color Components
Color Components - RGBA color manipulation
Scene, Frame, Color, Caption ✅ ok view · raw
128 Color Animation Channels
Color Channel Animation - Animate individual RGBA
Caption, Color, Easing, Frame, Scene, Timer ran view · raw

Find

# Snippet Objects Status Source
066 Find Elements
Find Elements - Locate UI by name
Scene, Frame, Color, Caption, find ❌ broken view · raw

Collection

# Snippet Objects Status Source
067 Collection Iteration
Collection Iteration - Loop through UI children
Scene, Frame, Color, Caption ✅ ok view · raw

Window

# Snippet Objects Status Source
069 Window Properties
Window Properties - Access window settings
Scene, Frame, Color, Caption ✅ ok view · raw

Keyboard

# Snippet Objects Status Source
070 Keyboard State
Keyboard State - Track key presses
Scene, Frame, Caption, Color, InputState ✅ ok view · raw

Mouse

# Snippet Objects Status Source
071 Mouse State
Mouse State - Track mouse position and buttons
Caption, Color, Frame, Scene, Timer, Vector ran view · raw

Ui

# Snippet Objects Status Source
072 Ui Button
UI Button - Interactive button with hover
Caption, Color, Frame, InputState, Scene ✅ ok view · raw
073 Ui Health Bar
UI Health Bar - Animated health display
Caption, Color, Easing, Frame, InputState, Key, Scene ✅ ok view · raw
074 Ui Tooltip
UI Tooltip - Hover tooltip display
Caption, Color, Frame, Scene, Vector ✅ ok view · raw
075 Ui Message Log
UI Message Log - Scrolling text messages
Caption, Color, Frame, Scene, Timer ran view · raw
118 Ui Modal
UI Modal Dialog - Popup confirmation
Caption, Color, Easing, Frame, InputState, Key, Scene ✅ ok view · raw

Effect

# Snippet Objects Status Source
076 Effect Screen Shake
Effect Screen Shake - Impact feedback
Caption, Color, Frame, InputState, Key, Scene, Timer ✅ ok view · raw
077 Effect Damage Flash
Effect Damage Flash - Hit feedback on frame
Caption, Color, Easing, Frame, InputState, Key, Scene, Sprite, Timer ✅ ok view · raw
078 Effect Floating Text
Effect Floating Text - Damage numbers
Caption, Color, Easing, Frame, InputState, Scene, Timer ✅ ok view · raw
079 Effect Pulse
Effect Pulse - Pulsing highlight
Caption, Color, Frame, Scene, Timer ran view · raw

Game

# Snippet Objects Status Source
080 Game Turn Based
Game Turn-Based - Simple turn system
Caption, Color, Entity, Grid, InputState, Key, Scene, Timer ✅ ok view · raw
081 Game Inventory
Game Inventory - Grid-based inventory UI
Caption, Color, Frame, Scene, Sprite ✅ ok view · raw
082 Game Minimap
Game Minimap - Small overview map
Caption, Color, Entity, Grid, InputState, Key, Scene ✅ ok view · raw
119 Game Collision
Game Collision - Simple collision detection
Caption, Color, Entity, Grid, InputState, Key, Scene ✅ ok view · raw

Bresenham

# Snippet Objects Status Source
084 Bresenham Line
Bresenham Line - Draw lines on grid
bresenham, Caption, Color, ColorLayer, Grid, Scene ✅ ok view · raw

Procgen

# Snippet Objects Status Source
086 Procgen Cellular
Procgen Cellular - Cave generation
Caption, Grid, Scene ✅ ok view · raw

Camera

# Snippet Objects Status Source
089 Camera Follow
Camera Follow - Camera tracks entity
Caption, Color, Easing, Entity, Grid, InputState, Key, Scene ✅ ok view · raw

Metrics

# Snippet Objects Status Source
091 Metrics Display
Metrics Display - Performance monitoring
Caption, Color, Frame, Scene, Timer ran view · raw

Global

# Snippet Objects Status Source
092 Global Pos
Global Position - World coordinates
Caption, Color, Frame, Scene ✅ ok view · raw

Parent

# Snippet Objects Status Source
093 Parent Reference
Parent Reference - Access parent from child
Caption, Color, Frame, InputState, Scene ✅ ok view · raw

Hovered

# Snippet Objects Status Source
097 Hovered State
Hovered State - Check if element is hovered
Caption, Color, Frame, Scene, Timer ran view · raw

Complete

# Snippet Objects Status Source
100 Complete Game
Complete Mini-Game - Putting it all together
Caption, Color, Entity, Frame, Grid, InputState, Key, Scene ✅ ok view · raw

Texture

# Snippet Objects Status Source
104 Texture Properties
Texture Properties - Texture information
Caption, Color, Frame, Scene, Sprite, current_scene, default_texture ✅ ok view · raw

Scenes

# Snippet Objects Status Source
105 Scenes Dict
Scenes Tuple - Access all scenes
Caption, Color, Frame, Scene, current_scene, scenes ✅ ok view · raw

Timers

# Snippet Objects Status Source
106 Timers List
Timers List - View all active timers
Caption, Color, Frame, Scene, Timer, current_scene, timers ran view · raw

Animations

# Snippet Objects Status Source
107 Animations List
Animations List - View all active animations
Caption, Color, Easing, Frame, Scene, Timer, animations, current_scene ran view · raw

Cache

# Snippet Objects Status Source
108 Cache Subtree
Cache Subtree - Performance optimization
Caption, Color, Frame, Scene, current_scene ✅ ok view · raw

Realign

# Snippet Objects Status Source
109 Realign
Realign - Reapply alignment after changes
Alignment, Caption, Color, Frame, InputState, Key, Scene, current_scene ✅ ok view · raw

Version

# Snippet Objects Status Source
110 Version Info
Version Info - Engine version and info
Caption, Color, Frame, Scene, Sprite, __version__, current_scene, default_texture ✅ ok view · raw

Alignment

# Snippet Objects Status Source
111 Alignment Margins
Alignment Margins - Spacing from edges
Alignment, Caption, Color, Frame, Scene ✅ ok view · raw

Easing

# Snippet Objects Status Source
113 Easing Cubic
Easing Cubic - Cubic easing functions
Caption, Color, Easing, Frame, Scene, Timer ran view · raw
114 Easing Sine
Easing Sine - Sinusoidal easing
Caption, Color, Easing, Frame, Scene, Timer ran view · raw
115 Easing Expo
Easing Exponential - Dramatic acceleration
Caption, Color, Easing, Frame, Scene, Timer ran view · raw
116 Easing Circ
Easing Circular - Circular motion curve
Caption, Color, Easing, Frame, Scene, Timer ran view · raw
117 Easing Quart
Easing Quartic - Strong power easing
Caption, Color, Easing, Frame, Scene, Timer ran view · raw

Default

# Snippet Objects Status Source
122 Default Fov
Default FOV - Set default algorithm
Caption, Color, Entity, FOV, Frame, Grid, Scene ✅ ok view · raw

Exit

# Snippet Objects Status Source
130 Exit Game
Exit Game - Clean shutdown
Caption, Color, Frame, InputState, Key, Scene, Timer ✅ ok view · raw

Engine Demo Screens

25 interactive demo screens from the engine test harness (tests/demo/screens/). Run them with ./mcrogueface ../tests/demo/demo_main.py.

Screen Thumbnail Source
animation_demo ❌ missing view · raw
billboard_building_demo ❌ missing view · raw
caption_demo ❌ missing view · raw
color_demo ❌ missing view · raw
entity3d_demo ❌ missing view · raw
focus_system_demo ❌ missing view · raw
frame_demo ❌ missing view · raw
grid_demo ❌ missing view · raw
integration_demo ❌ missing view · raw
ldtk_demo ❌ missing view · raw
model_loading_demo ❌ missing view · raw
navigation_demo ❌ missing view · raw
navigation_screenshot ❌ missing view · raw
pathfinding_demo ❌ missing view · raw
primitives_demo ❌ missing view · raw
skeletal_animation_demo ❌ missing view · raw
terrain_demo ❌ missing view · raw
tiled_analysis ❌ missing view · raw
tiled_demo ❌ missing view · raw
village_demo ❌ missing view · raw
voxel_core_demo ❌ missing view · raw
voxel_dungeon_demo ❌ missing view · raw
voxel_meshing_demo ❌ missing view · raw
voxel_navigation_demo ❌ missing view · raw
voxel_serialization_demo ❌ missing view · raw

Games

Full games built on McRogueFace. Web/desktop packaging is pending — these are listed from the engine repo’s games/ directory and are not yet downloadable builds.

Game Source Status
unwritten browse packaging pending