var draw2d = use('draw2d') var color = use('color') function update(dt) { // Update game logic here return {} } function draw() { // Clear the draw list draw2d.clear() // Draw a red outlined rectangle draw2d.rectangle( {x: 100, y: 100, width: 200, height: 150}, // rect {thickness: 3}, // geometry options {color: color.red} // material ) // Draw a filled green circle draw2d.circle( [300, 300], // position 50, // radius {thickness: 0}, // geometry (0 = filled) {color: color.green} // material ) // Draw blue rounded rectangle draw2d.rectangle( {x: 350, y: 200, width: 150, height: 100}, {thickness: 2, radius: 15}, // rounded corners {color: color.blue} ) // Draw text draw2d.text( "Hello from Prosperon!", {x: 50, y: 50}, 'fonts/c64.ttf', 16, color.white, // no wrap ) // Draw a line draw2d.line( [[50, 400], [150, 450], [250, 400]], {thickness: 2}, {color: color.yellow} ) draw2d.image("tests/bunny", {x:0,y:0}) // Return the draw commands return draw2d.get_commands() } $receiver(e => { if (e.kind == 'update') send(e, update(e.dt)) else if (e.kind == 'draw') send(e, draw()) })