Examples¶
Note
Under construction.
An introduction to the apps bundled under /app/. Each one demonstrates specific APIs and features, so try running them first and use the source code as a reference when building your own apps.
Source file locations:
- mruby apps: fmruby-core/app/<category>/<name>.app.rb
- Configuration: <name>.app.toml in the same directory
Demo (demo)¶
Sample apps that showcase basic features.
| App | Description | APIs Covered |
|---|---|---|
mruby.app.rb |
Minimal mruby verification sample | FmrbApp, FmrbGfx basics |
shapes.app.rb |
Comprehensive shape drawing demo (rectangles, circles, ellipses, triangles, arcs, text) | FmrbGfx |
ja_text.app.rb |
Japanese text rendering. Switches between Default / misaki_8 / efontJA_12 / Mixed / Hybrid / Scaled | FmrbGfx#set_font |
p5_test.app.rb |
Demo of a Processing/p5.js-style drawing library (basic shapes / affine transforms / Bezier curves / text / blend / get_pixel) | P5 |
i2c_kbd.app.rb |
Reading input from an I2C keyboard (address 0x5F) |
I2C + Pub/Sub |
led_matrix.app.rb |
Controlling a WS2812B 8x8 RGB LED matrix + on-screen preview | RMT, Pub/Sub |
pub_demo.app.rb + sub_demo.app.rb |
Minimal inter-app Pub/Sub pair | Pub/Sub |
lua.app.lua |
Lua VM verification | -- |
basic.app.bas / bounce.app.bas |
BASIC VM verification | -- |
Debug (debug)¶
Verification apps under /app/debug/.
| App | Description | APIs Covered |
|---|---|---|
ntsc_color_test.app.rb |
NTSC color bar output test | FmrbGfx#set_output_level/set_chroma_level |
sd_test.app.rb |
Writes to /mnt/sd/sd_test.txt, reads back, and compares. Press Space to re-run |
File I/O > File Namespace |
tile_map_test.app.rb |
Map rendering with TileMap + TileSheet + JSON | TileMap / TileSheet |
draw_tile_test.app.rb |
Minimal verification of FmrbGfx#draw_tile |
FmrbGfx > draw_tile |
Games (game)¶
| App | Description | APIs Covered |
|---|---|---|
flappy.rb |
Flappy Bird-style game. Tap to fly up, avoid obstacles | FmrbGfx, FmrbAudio (note_on/off), gamepad |
tetris.app.rb |
Tetris-style falling block puzzle. Arrow key controls | FmrbGfx, board drawing patterns |
shooter.app.rb |
Full-screen shooter | Sprite, collision detection |
raycaster.app.rb |
Wolfenstein 3D-style pseudo-3D. Requires large_memory = 1 |
Fixed-point arithmetic, high-speed FmrbGfx rendering |
piano.app.rb |
A piano you can play with the keyboard | FmrbAudio#note_on/off |
rpg_demo/ |
JRPG-style sample. Assets bundled in /app/<cat>/<bundle>/ format |
TileMap / TileSheet, FmrbApp.set_cursor_visible |
Tools (tool)¶
| App | Description | APIs Covered |
|---|---|---|
gpio_viewer.app.rb |
Visualizes the usage status of all GPIO pins | FmrbHw.pin_status |
nsf_player.app.rb |
NSF file playback GUI (skip, track selection, pause) | FmrbAudio#play, file selection |
picorabbit.app.rb |
Markdown slide presentation player | PicoRabbit |
sprite_editor.app.rb |
Sprite editor. Draw pixel art and save as BMP | Sprite, BMP332 |
Recommended Learning Order¶
- Read
mruby.app.rbto understand the basic structure - Check
shapes.app.rbto learn how to useFmrbGfx - Try
pub_demo.app.rb/sub_demo.app.rbfor inter-app messaging - Explore
piano.app.rbfor the audio API - Study
flappy.rbfor combining drawing + audio + input - Examine
tetris.app.rbfor a stateful game - Analyze
raycaster.app.rbfor large-scale app structure and optimization
Starting Points for Your Own Apps¶
- For a minimal starting point:
mruby.app.rb - For window + drawing:
shapes.app.rb - For making a game:
tetris.app.rborflappy.rb - For working with hardware:
i2c_kbd.app.rborled_matrix.app.rb
See Hello World for how to start a new app.
Related¶
- How to create apps: Hello World
- Icon files: Image and Icon Files
- App configuration: App Configuration File (.toml)