KISS ASCII Renderer - Development Progress ​
Completed Features ✅ ​
1. Core Types and Interfaces ​
- ✅ Cell, Color, RenderTarget interface
- ✅ Box and text option types
- ✅ Full TypeScript strict mode support
- ✅ Comprehensive type definitions
- Tests: 6 passing | Docs: core-types.md
2. Color Utilities ​
- ✅ parseColor() - Parse any color format to RGB
- ✅ rgbToHex() - Convert RGB to hex
- ✅ toCSSColor() - Convert to CSS strings
- ✅ lerp() - Color interpolation
- ✅ brighten() - Brighten colors
- ✅ darken() - Darken colors
- Tests: 22 passing | Docs: color-utilities.md
3. CanvasTarget ​
- ✅ Browser canvas rendering
- ✅ Custom character/font dimensions
- ✅ Full color support
- ✅ Immediate rendering mode
- Tests: 12 passing | Docs: canvas-target.md
4. Core Renderer ​
- ✅ setChar() - Set single characters
- ✅ drawText() - Draw text strings
- ✅ fill() - Fill rectangles
- ✅ clear() - Clear buffer
- ✅ render() - Flush to target
- ✅ Safe mode and clip mode
- ✅ Double-buffering
- ✅ Method chaining
- Tests: 26 passing | Docs: renderer-api.md
5. Box Drawing ​
- ✅ box() - Draw boxes with borders
- ✅ border() - Border-only boxes
- ✅ rect() - Filled rectangles
- ✅ Multiple border styles (single, double, rounded, heavy, ASCII)
- ✅ Custom border characters
- ✅ Interior fill support
- Tests: 21 passing | Docs: box-drawing.md
6. Text Alignment ​
- ✅ centerText() - Horizontal centering
- ✅ rightAlign() - Right-aligned text
- ✅ leftAlign() - Left-aligned text
- ✅ alignText() - Dynamic alignment
- ✅ Custom width/offset support
- Tests: 20 passing | Docs: alignment.md
7. Layer System ​
- ✅ layer() - Select/create layers
- ✅ layerOrder() - Set z-index
- ✅ hideLayer() / showLayer()
- ✅ clearLayer() - Clear specific layers
- ✅ Per-layer rendering with compositing
- Tests: 17 passing | Docs: layer-system.md
8. Menu Helper ​
- ✅ menu() - Render interactive menus
- ✅ Selection indicators
- ✅ Custom colors for selected items
- ✅ Optional borders and titles
- ✅ Auto-sizing and padding
- Tests: 13 passing | Docs: menu-helper.md
9. Progress Bar Helper ​
- ✅ progressBar() - Draw progress indicators
- ✅ Horizontal and vertical orientations
- ✅ Multiple style presets (blocks, dots, arrows)
- ✅ Custom fill/empty characters
- ✅ Border and label support
- ✅ Percentage display
- Tests: 14 passing | Docs: progress-bar.md
10. Panel Helper ​
- ✅ panel() - Bordered containers with content areas
- ✅ Titles and footers in borders
- ✅ Scrollable content with offset control
- ✅ Text alignment for titles and content
- ✅ Inner padding support
- ✅ Multiple border styles
- Tests: 13 passing | Docs: panel-helper.md
11. Camera/Viewport System ​
- ✅ setCamera() / resetCamera() - Control viewport position
- ✅ follow() - Center camera on target (e.g., player)
- ✅ moveCamera() - Relative camera movement
- ✅ worldToScreen() / screenToWorld() - Coordinate conversion
- ✅ Automatic world-to-screen transformation
- ✅ Works seamlessly with all drawing methods
- Tests: 22 passing | Docs: camera-system.md
12. Keyboard Input System ​
- ✅ KeyboardManager class for game input
- ✅ isPressed() - Real-time key state checking
- ✅ justPressed() / justReleased() - Frame-based detection
- ✅ getDirection() - WASD/Arrow → {x, y} direction vector
- ✅ waitForKey() - Promise-based key waiting
- ✅ onKeyDown() / onKeyUp() - Event callbacks
- ✅ Multi-key support and combinations
- ✅ Game loop integration with update()
- Tests: 49 passing | Docs: keyboard-input.md
13. Gamepad/Controller Input System ​
- ✅ GamepadManager class for controller support
- ✅ Button tracking with just-pressed detection
- ✅ Analog stick input (left/right) with deadzone
- ✅ D-pad directional input
- ✅ Vibration/rumble support (dual-motor)
- ✅ Multi-controller support (up to 4 players)
- ✅ Connection/disconnection events
- ✅ Frame-based updates with game loop integration
- Tests: 40 passing | Docs: gamepad-input.md
14. Pointer Input System ​
- ✅ PointerManager class for unified mouse/touch/pen input
- ✅ Position tracking (pixel and grid coordinates)
- ✅ Button state (left, right, middle) and touch tracking
- ✅ justPressed() / justReleased() - Frame-based detection
- ✅ onClick() / onHover() - Event callbacks
- ✅ Drag detection with delta tracking
- ✅ Grid cell hover detection
- ✅ Multi-touch and pressure support
- ✅ World coordinate conversion with camera offset
- Tests: 30+ passing | Docs: pointer-input.md
- Migration: mouse-input.md (deprecated, use PointerManager)
15. Game Loop Utility ​
- ✅ Fixed timestep game loop
- ✅ Delta time support for frame-independent updates
- ✅ FPS management (target and actual FPS tracking)
- ✅ Pause/resume functionality
- ✅ Elapsed time tracking
- ✅ Frame skip protection
- ✅ Optional render callback for headless mode
- Tests: 14 passing | Docs: game-loop.md
Test Coverage Summary ​
- Total Test Files: 21
- Total Tests: 428 total (428 passing)
- Coverage: >90% on all core modules
Build Status ​
- Lint: Passing ✅
- TypeScript: Compiling ✅
- Build: Success ✅
- Bundle Size:
- ES Module: 20.37 KB (5.56 KB gzipped)
- UMD: 13.06 KB (4.47 KB gzipped)
Commits ​
feat(core): add core types, color utilities, and CanvasTargetfeat(renderer): implement core Renderer class with primitivesfeat(renderer): add box drawing functionalityfeat(renderer): add text alignment helpersfeat(layers): implement layer system with z-order and compositingfeat(menu): implement menu helper functionfeat(progressBar): implement progress bar helperfeat(panel): implement panel helper with scrollable contentfix: correct alignment and rect method signatures after refactoringfeat(camera): implement camera/viewport system with coordinate transformationfeat(keyboard): implement keyboard input manager with game loop integrationfeat(mouse): implement mouse input manager with grid/world coordinate conversionfeat(gameloop): implement fixed timestep game loop with delta time support
Remaining Features (Future Work) ​
Other Planned Features ​
- [ ] Debug visualization
- [ ] Export/screenshot
- [ ] DOM render target
API Example ​
typescript
import { Renderer, CanvasTarget } from "@shaisrc/tty";
const canvas = document.getElementById("game") as HTMLCanvasElement;
const target = new CanvasTarget(canvas, { width: 80, height: 24 });
const renderer = new Renderer(target);
// Draw a simple UI
renderer
.clear()
.fill(0, 0, 80, 24, " ", null, "black")
.box(2, 2, 76, 20, { style: "double", fg: "cyan" })
.centerText(3, "=== GAME TITLE ===", { fg: "yellow" })
.box(10, 8, 60, 10, { style: "single", fg: "white" })
.centerText(9, "Main Menu", { fg: "white" }, 10, 60)
.centerText(11, "> New Game", { fg: "yellow" }, 10, 60)
.centerText(12, "Continue", { fg: "white" }, 10, 60)
.centerText(13, "Settings", { fg: "white" }, 10, 60)
.centerText(14, "Quit", { fg: "white" }, 10, 60)
.render();Development Workflow ​
Running Tests ​
bash
npm testLinting ​
bash
npm run lintBuilding ​
bash
npm run buildPre-commit Checklist ​
- [x] Lint passes
- [x] Tests pass (>90% coverage)
- [x] Build succeeds
- [x] Documentation updated
- [x] Commit with conventional format
Project Philosophy (KISS) ​
✅ Simple API - Chainable methods, smart defaults
✅ No Framework - Just drawing functions
✅ Output Agnostic - RenderTarget interface
✅ Performance First - Double-buffering, minimal overhead
✅ TypeScript First - Full type safety and autocomplete
✅ Well Tested - TDD approach, high coverage
✅ Well Documented - Complete docs for every feature
Next Steps ​
The core library is now fully functional for building ASCII games and UIs. Future work will focus on:
- Examples - Create example games/demos
- Layer System - Multi-layer rendering support
- Helper Libraries - Menu builders, dialog systems, etc.
- Additional Targets - DOM renderer
- Performance - Dirty rectangle optimization
- Publishing - Prepare for npm release
License ​
See LICENSE file.
