fuzzyworld

nordic-skating / local-littlejs / files / src / prototype / littlejs-prototype.ts

Branch local-littlejs · default branch · all branches

littlejs-prototype.ts

1.0 KB · history · blame

1/**
2 * Minimal LittleJS prototype for Nordic Skating
3 * This file tests basic LittleJS integration with the project
4 */
5
6import * as LITTLEJS from 'littlejsengine'
7
8// Simple test scene to verify LittleJS works in the project
9function gameInit() {
10 console.log('LittleJS Prototype: Initializing')
11
12 // Test basic engine functionality
13 const canvas = document.getElementById('game-canvas') as HTMLCanvasElement | null
14 if (canvas) {
15 console.log('Canvas found:', canvas)
16 } else {
17 console.error('Canvas not found')
18 }
19}
20
21function gameUpdate() {
22 // Basic update loop
23}
24
25function gameUpdatePost() {
26 // Post-update operations
27}
28
29function gameRender() {
30 // Test rendering with a simple message
31 LITTLEJS.drawText('LittleJS Prototype', LITTLEJS.mainCanvasSize.scale(0.5), 80)
32}
33
34function gameRenderPost() {
35 // Post-render operations
36}
37
38// Initialize the engine
39export function initLittleJSPrototype() {
40 console.log('Initializing LittleJS prototype...')
41 LITTLEJS.engineInit(gameInit, gameUpdate, gameUpdatePost, gameRender, gameRenderPost)
42}