mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-17 15:04:52 +00:00
feat(tui): overlay positioning API with CSS-like values
Add OverlayOptions for configurable positioning (anchor, margins, offsets, percentages). Add OverlayHandle for programmatic visibility control with hide/setHidden/isHidden. Add visible callback for responsive overlays. Extension API: ctx.ui.custom() now accepts overlayOptions and onHandle callback. Examples: overlay-qa-tests.ts (10 test commands), doom-overlay (DOOM at 35 FPS).
This commit is contained in:
parent
d29f268f46
commit
a4ccff382c
22 changed files with 1344 additions and 103 deletions
|
|
@ -0,0 +1,46 @@
|
|||
# DOOM Overlay Demo
|
||||
|
||||
Play DOOM as an overlay in pi. Demonstrates that the overlay system can handle real-time game rendering at 35 FPS.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
pi --extension ./examples/extensions/doom-overlay
|
||||
```
|
||||
|
||||
Then run:
|
||||
```
|
||||
/doom-overlay
|
||||
```
|
||||
|
||||
The shareware WAD file (~4MB) is auto-downloaded on first run.
|
||||
|
||||
## Controls
|
||||
|
||||
| Action | Keys |
|
||||
|--------|------|
|
||||
| Move | WASD or Arrow Keys |
|
||||
| Run | Shift + WASD |
|
||||
| Fire | F or Ctrl |
|
||||
| Use/Open | Space |
|
||||
| Weapons | 1-7 |
|
||||
| Map | Tab |
|
||||
| Menu | Escape |
|
||||
| Pause/Quit | Q |
|
||||
|
||||
## How It Works
|
||||
|
||||
DOOM runs as WebAssembly compiled from [doomgeneric](https://github.com/ozkl/doomgeneric). Each frame is rendered using half-block characters (▀) with 24-bit color, where the top pixel is the foreground color and the bottom pixel is the background color.
|
||||
|
||||
The overlay uses:
|
||||
- `width: "90%"` - 90% of terminal width
|
||||
- `maxHeight: "80%"` - Maximum 80% of terminal height
|
||||
- `anchor: "center"` - Centered in terminal
|
||||
|
||||
Height is calculated from width to maintain DOOM's 3.2:1 aspect ratio (accounting for half-block rendering).
|
||||
|
||||
## Credits
|
||||
|
||||
- [id Software](https://github.com/id-Software/DOOM) for the original DOOM
|
||||
- [doomgeneric](https://github.com/ozkl/doomgeneric) for the portable DOOM implementation
|
||||
- [pi-doom](https://github.com/badlogic/pi-doom) for the original pi integration
|
||||
Loading…
Add table
Add a link
Reference in a new issue