diff --git a/clay.cm b/clay.cm index b2f6276e..e6ff867d 100644 --- a/clay.cm +++ b/clay.cm @@ -87,16 +87,17 @@ function annotate_tree(node, root_height, parent_node) { } clay.layout = function(fn, size) { + var sz = is_array(size) ? {width: size[0], height: size[1]} : size lay_ctx.reset() _next_id = 0 var root_id = lay_ctx.item() - lay_ctx.set_size(root_id, size) + lay_ctx.set_size(root_id, sz) lay_ctx.set_contain(root_id, layout.contain.row) var root_node = { id: root_id, - config: meme(base_config, {size: size}), + config: meme(base_config, {size: sz}), children: [] } @@ -107,10 +108,10 @@ clay.layout = function(fn, size) { lay_ctx.run() // Annotate tree for clay_input (boundingbox, CHILDREN, PARENT) - annotate_tree(root_node, size.height, null) + annotate_tree(root_node, sz.height, null) // Build flat drawable list and attach to tree root - root_node.drawables = build_drawables(root_node, size.height) + root_node.drawables = build_drawables(root_node, sz.height) return root_node } @@ -384,9 +385,10 @@ clay.button = function(str, action, configs) { }] var _configs = is_array(configs) ? configs : [configs] + var merged = process_configs(_configs) clay.zstack(array(btn_config, _configs), function() { - clay.text(str, {color: {r:1,g:1,b:1,a:1}}) + clay.text(str, {color: {r:1,g:1,b:1,a:1}, font_path: merged.font_path}) }) } diff --git a/examples/bisect.ce b/examples/bisect.ce new file mode 100644 index 00000000..bfc13f30 --- /dev/null +++ b/examples/bisect.ce @@ -0,0 +1,45 @@ +log.console("bisect: start") +var sprite = use('sprite') +var clay = use('clay') +var core = use('core') +var fx_graph = use('fx_graph') +var sdl_gpu = use('sdl_gpu') +log.console("bisect: modules loaded") + +core.start({ + width: 640, + height: 480, + title: "Paladin Simple", + framerate: 60, + update: function(dt) {}, + render: function() { + var win_size = core.window_size() + var graph = fx_graph.create() + + var ui_scene = clay.layout(function() { + clay.container({padding: 20, contain: clay.contain.content}, function() { + clay.vstack({ + padding: 20, + spacing: 10, + width: 200 + }, function() { + clay.text("PALADIN UI", {font_size: 24, color: {r:1, g:0.8, b:0.2, a:1}}) + clay.text("Item 1") + clay.text("Item 2") + }) + }) + }, [win_size.width, win_size.height]) + + graph.add_node('render_view', { + root: ui_scene, + camera: {pos: [0, 0], width: win_size.width, height: win_size.height, anchor: [0, 0], ortho: true}, + target: 'screen', + clear_color: {r:0,g:0,b:0,a:0} + }) + + return graph + }, + input: function(ev) { + if (ev.type == 'quit') $stop() + } +}) diff --git a/examples/bunny.png b/examples/bunny.png new file mode 100644 index 00000000..79c31675 Binary files /dev/null and b/examples/bunny.png differ diff --git a/examples/enemies/barnacle_attack_a.png b/examples/enemies/barnacle_attack_a.png new file mode 100644 index 00000000..ed64bf2e Binary files /dev/null and b/examples/enemies/barnacle_attack_a.png differ diff --git a/examples/enemies/barnacle_attack_b.png b/examples/enemies/barnacle_attack_b.png new file mode 100644 index 00000000..0dd260d1 Binary files /dev/null and b/examples/enemies/barnacle_attack_b.png differ diff --git a/examples/enemies/barnacle_attack_rest.png b/examples/enemies/barnacle_attack_rest.png new file mode 100644 index 00000000..fee0a360 Binary files /dev/null and b/examples/enemies/barnacle_attack_rest.png differ diff --git a/examples/enemies/bee_a.png b/examples/enemies/bee_a.png new file mode 100644 index 00000000..35f8e83d Binary files /dev/null and b/examples/enemies/bee_a.png differ diff --git a/examples/enemies/bee_b.png b/examples/enemies/bee_b.png new file mode 100644 index 00000000..f06d4e2a Binary files /dev/null and b/examples/enemies/bee_b.png differ diff --git a/examples/enemies/bee_rest.png b/examples/enemies/bee_rest.png new file mode 100644 index 00000000..ab2cd959 Binary files /dev/null and b/examples/enemies/bee_rest.png differ diff --git a/examples/enemies/block_fall.png b/examples/enemies/block_fall.png new file mode 100644 index 00000000..0f8d3790 Binary files /dev/null and b/examples/enemies/block_fall.png differ diff --git a/examples/enemies/block_idle.png b/examples/enemies/block_idle.png new file mode 100644 index 00000000..90269649 Binary files /dev/null and b/examples/enemies/block_idle.png differ diff --git a/examples/enemies/block_rest.png b/examples/enemies/block_rest.png new file mode 100644 index 00000000..d00191d7 Binary files /dev/null and b/examples/enemies/block_rest.png differ diff --git a/examples/enemies/fish_blue_rest.png b/examples/enemies/fish_blue_rest.png new file mode 100644 index 00000000..c4729ba9 Binary files /dev/null and b/examples/enemies/fish_blue_rest.png differ diff --git a/examples/enemies/fish_blue_swim_a.png b/examples/enemies/fish_blue_swim_a.png new file mode 100644 index 00000000..8f45eba6 Binary files /dev/null and b/examples/enemies/fish_blue_swim_a.png differ diff --git a/examples/enemies/fish_blue_swim_b.png b/examples/enemies/fish_blue_swim_b.png new file mode 100644 index 00000000..f1ee560f Binary files /dev/null and b/examples/enemies/fish_blue_swim_b.png differ diff --git a/examples/enemies/fish_purple_down.png b/examples/enemies/fish_purple_down.png new file mode 100644 index 00000000..772aef3f Binary files /dev/null and b/examples/enemies/fish_purple_down.png differ diff --git a/examples/enemies/fish_purple_rest.png b/examples/enemies/fish_purple_rest.png new file mode 100644 index 00000000..c8b0aee9 Binary files /dev/null and b/examples/enemies/fish_purple_rest.png differ diff --git a/examples/enemies/fish_purple_up.png b/examples/enemies/fish_purple_up.png new file mode 100644 index 00000000..7f71c221 Binary files /dev/null and b/examples/enemies/fish_purple_up.png differ diff --git a/examples/enemies/fish_yellow_rest.png b/examples/enemies/fish_yellow_rest.png new file mode 100644 index 00000000..2de306ac Binary files /dev/null and b/examples/enemies/fish_yellow_rest.png differ diff --git a/examples/enemies/fish_yellow_swim_a.png b/examples/enemies/fish_yellow_swim_a.png new file mode 100644 index 00000000..b820ac8d Binary files /dev/null and b/examples/enemies/fish_yellow_swim_a.png differ diff --git a/examples/enemies/fish_yellow_swim_b.png b/examples/enemies/fish_yellow_swim_b.png new file mode 100644 index 00000000..c886a740 Binary files /dev/null and b/examples/enemies/fish_yellow_swim_b.png differ diff --git a/examples/enemies/fly_a.png b/examples/enemies/fly_a.png new file mode 100644 index 00000000..d416f153 Binary files /dev/null and b/examples/enemies/fly_a.png differ diff --git a/examples/enemies/fly_b.png b/examples/enemies/fly_b.png new file mode 100644 index 00000000..3d6670a1 Binary files /dev/null and b/examples/enemies/fly_b.png differ diff --git a/examples/enemies/fly_rest.png b/examples/enemies/fly_rest.png new file mode 100644 index 00000000..fd84071b Binary files /dev/null and b/examples/enemies/fly_rest.png differ diff --git a/examples/enemies/frog_idle.png b/examples/enemies/frog_idle.png new file mode 100644 index 00000000..11f7826c Binary files /dev/null and b/examples/enemies/frog_idle.png differ diff --git a/examples/enemies/frog_jump.png b/examples/enemies/frog_jump.png new file mode 100644 index 00000000..a5ace229 Binary files /dev/null and b/examples/enemies/frog_jump.png differ diff --git a/examples/enemies/frog_rest.png b/examples/enemies/frog_rest.png new file mode 100644 index 00000000..63b625fe Binary files /dev/null and b/examples/enemies/frog_rest.png differ diff --git a/examples/enemies/ladybug_fly.png b/examples/enemies/ladybug_fly.png new file mode 100644 index 00000000..c912b39d Binary files /dev/null and b/examples/enemies/ladybug_fly.png differ diff --git a/examples/enemies/ladybug_rest.png b/examples/enemies/ladybug_rest.png new file mode 100644 index 00000000..09cc138f Binary files /dev/null and b/examples/enemies/ladybug_rest.png differ diff --git a/examples/enemies/ladybug_walk_a.png b/examples/enemies/ladybug_walk_a.png new file mode 100644 index 00000000..56489ab3 Binary files /dev/null and b/examples/enemies/ladybug_walk_a.png differ diff --git a/examples/enemies/ladybug_walk_b.png b/examples/enemies/ladybug_walk_b.png new file mode 100644 index 00000000..8957a654 Binary files /dev/null and b/examples/enemies/ladybug_walk_b.png differ diff --git a/examples/enemies/mouse_rest.png b/examples/enemies/mouse_rest.png new file mode 100644 index 00000000..db1ecbbf Binary files /dev/null and b/examples/enemies/mouse_rest.png differ diff --git a/examples/enemies/mouse_walk_a.png b/examples/enemies/mouse_walk_a.png new file mode 100644 index 00000000..0b721725 Binary files /dev/null and b/examples/enemies/mouse_walk_a.png differ diff --git a/examples/enemies/mouse_walk_b.png b/examples/enemies/mouse_walk_b.png new file mode 100644 index 00000000..b9b0d727 Binary files /dev/null and b/examples/enemies/mouse_walk_b.png differ diff --git a/examples/enemies/saw_a.png b/examples/enemies/saw_a.png new file mode 100644 index 00000000..48726fee Binary files /dev/null and b/examples/enemies/saw_a.png differ diff --git a/examples/enemies/saw_b.png b/examples/enemies/saw_b.png new file mode 100644 index 00000000..2d86aa4c Binary files /dev/null and b/examples/enemies/saw_b.png differ diff --git a/examples/enemies/saw_rest.png b/examples/enemies/saw_rest.png new file mode 100644 index 00000000..654f3ef8 Binary files /dev/null and b/examples/enemies/saw_rest.png differ diff --git a/examples/enemies/slime_block_jump.png b/examples/enemies/slime_block_jump.png new file mode 100644 index 00000000..9c447314 Binary files /dev/null and b/examples/enemies/slime_block_jump.png differ diff --git a/examples/enemies/slime_block_rest.png b/examples/enemies/slime_block_rest.png new file mode 100644 index 00000000..6cbb02f6 Binary files /dev/null and b/examples/enemies/slime_block_rest.png differ diff --git a/examples/enemies/slime_block_walk_a.png b/examples/enemies/slime_block_walk_a.png new file mode 100644 index 00000000..95c2734e Binary files /dev/null and b/examples/enemies/slime_block_walk_a.png differ diff --git a/examples/enemies/slime_block_walk_b.png b/examples/enemies/slime_block_walk_b.png new file mode 100644 index 00000000..ba9f5a6d Binary files /dev/null and b/examples/enemies/slime_block_walk_b.png differ diff --git a/examples/enemies/slime_fire_flat.png b/examples/enemies/slime_fire_flat.png new file mode 100644 index 00000000..5aa9fe74 Binary files /dev/null and b/examples/enemies/slime_fire_flat.png differ diff --git a/examples/enemies/slime_fire_rest.png b/examples/enemies/slime_fire_rest.png new file mode 100644 index 00000000..6a072c45 Binary files /dev/null and b/examples/enemies/slime_fire_rest.png differ diff --git a/examples/enemies/slime_fire_walk_a.png b/examples/enemies/slime_fire_walk_a.png new file mode 100644 index 00000000..12f34a25 Binary files /dev/null and b/examples/enemies/slime_fire_walk_a.png differ diff --git a/examples/enemies/slime_fire_walk_b.png b/examples/enemies/slime_fire_walk_b.png new file mode 100644 index 00000000..db6d872a Binary files /dev/null and b/examples/enemies/slime_fire_walk_b.png differ diff --git a/examples/enemies/slime_normal_flat.png b/examples/enemies/slime_normal_flat.png new file mode 100644 index 00000000..6955d2a0 Binary files /dev/null and b/examples/enemies/slime_normal_flat.png differ diff --git a/examples/enemies/slime_normal_rest.png b/examples/enemies/slime_normal_rest.png new file mode 100644 index 00000000..5aa3b721 Binary files /dev/null and b/examples/enemies/slime_normal_rest.png differ diff --git a/examples/enemies/slime_normal_walk_a.png b/examples/enemies/slime_normal_walk_a.png new file mode 100644 index 00000000..fe78a465 Binary files /dev/null and b/examples/enemies/slime_normal_walk_a.png differ diff --git a/examples/enemies/slime_normal_walk_b.png b/examples/enemies/slime_normal_walk_b.png new file mode 100644 index 00000000..0b4c49c7 Binary files /dev/null and b/examples/enemies/slime_normal_walk_b.png differ diff --git a/examples/enemies/slime_spike_flat.png b/examples/enemies/slime_spike_flat.png new file mode 100644 index 00000000..d89452a3 Binary files /dev/null and b/examples/enemies/slime_spike_flat.png differ diff --git a/examples/enemies/slime_spike_rest.png b/examples/enemies/slime_spike_rest.png new file mode 100644 index 00000000..7ded1b9a Binary files /dev/null and b/examples/enemies/slime_spike_rest.png differ diff --git a/examples/enemies/slime_spike_walk_a.png b/examples/enemies/slime_spike_walk_a.png new file mode 100644 index 00000000..53ec2fa4 Binary files /dev/null and b/examples/enemies/slime_spike_walk_a.png differ diff --git a/examples/enemies/slime_spike_walk_b.png b/examples/enemies/slime_spike_walk_b.png new file mode 100644 index 00000000..d2dcf70e Binary files /dev/null and b/examples/enemies/slime_spike_walk_b.png differ diff --git a/examples/enemies/snail_rest.png b/examples/enemies/snail_rest.png new file mode 100644 index 00000000..096f0359 Binary files /dev/null and b/examples/enemies/snail_rest.png differ diff --git a/examples/enemies/snail_shell.png b/examples/enemies/snail_shell.png new file mode 100644 index 00000000..2e3232bb Binary files /dev/null and b/examples/enemies/snail_shell.png differ diff --git a/examples/enemies/snail_walk_a.png b/examples/enemies/snail_walk_a.png new file mode 100644 index 00000000..40ec0e77 Binary files /dev/null and b/examples/enemies/snail_walk_a.png differ diff --git a/examples/enemies/snail_walk_b.png b/examples/enemies/snail_walk_b.png new file mode 100644 index 00000000..97d38e86 Binary files /dev/null and b/examples/enemies/snail_walk_b.png differ diff --git a/examples/enemies/worm_normal_move_a.png b/examples/enemies/worm_normal_move_a.png new file mode 100644 index 00000000..59cbb98b Binary files /dev/null and b/examples/enemies/worm_normal_move_a.png differ diff --git a/examples/enemies/worm_normal_move_b.png b/examples/enemies/worm_normal_move_b.png new file mode 100644 index 00000000..fd74ebc2 Binary files /dev/null and b/examples/enemies/worm_normal_move_b.png differ diff --git a/examples/enemies/worm_normal_rest.png b/examples/enemies/worm_normal_rest.png new file mode 100644 index 00000000..b18eccdc Binary files /dev/null and b/examples/enemies/worm_normal_rest.png differ diff --git a/examples/enemies/worm_ring_move_a.png b/examples/enemies/worm_ring_move_a.png new file mode 100644 index 00000000..5214b51a Binary files /dev/null and b/examples/enemies/worm_ring_move_a.png differ diff --git a/examples/enemies/worm_ring_move_b.png b/examples/enemies/worm_ring_move_b.png new file mode 100644 index 00000000..841636a2 Binary files /dev/null and b/examples/enemies/worm_ring_move_b.png differ diff --git a/examples/enemies/worm_ring_rest.png b/examples/enemies/worm_ring_rest.png new file mode 100644 index 00000000..678005ae Binary files /dev/null and b/examples/enemies/worm_ring_rest.png differ diff --git a/examples/fonts/c64.ttf b/examples/fonts/c64.ttf new file mode 100644 index 00000000..02ff5fc4 Binary files /dev/null and b/examples/fonts/c64.ttf differ diff --git a/examples/fonts/dos.ttf b/examples/fonts/dos.ttf new file mode 100644 index 00000000..6aaf28c5 Binary files /dev/null and b/examples/fonts/dos.ttf differ diff --git a/examples/fonts/teenytinypixels.ttf b/examples/fonts/teenytinypixels.ttf new file mode 100644 index 00000000..ebc33a56 Binary files /dev/null and b/examples/fonts/teenytinypixels.ttf differ diff --git a/examples/paladin.ce b/examples/paladin.ce new file mode 100644 index 00000000..ae0bdacc --- /dev/null +++ b/examples/paladin.ce @@ -0,0 +1,303 @@ +log.console("paladin game starting") + +var time = use('time') +var random = use('random').random + +var core = use('core') +var sprite = use('sprite') +var text2d = use('text2d') +var particles2d = use('particles2d') +var compositor = use('compositor') +var film2d = use('film2d') +var tilemap2d = use('tilemap2d') +var clay = use('clay') + +var sprites = [] // Keep references for cleanup +var emitters = [] // Particle emitters +var bunnies = [] // Bouncing bunnies for Y-sort test + +// Cameras +var world_camera = { + pos: {x: 2.5, y: 2.5}, + width: 5, + height: 5, + anchor: {x: 0.5, y: 0.5} +} + +var hud_camera = { + pos: {x: 0, y: 0}, + width: 640, + height: 360, + anchor: {x: 0, y: 0} +} + +// Group effects definition - THIS IS THE KEY PART +var group_effects = { + 'bloom': { + effects: [{type: 'bloom', threshold: 0.1, intensity: 5, blur_passes: 1}] + }, + 'masked_fire': { + effects: [ + {type: 'bloom', threshold: 0.1, intensity: 5, blur_passes: 0}, + {type: 'mask', channel: 'alpha', mask_group: 'mask_text'} + ] + }, + 'corner_fire': { + effects: [{type: 'mask', channel: 'alpha', mask_group: 'corner_mask'}] + } +} + +// Compositor config - pure data +var compositor_config = { + clear: {r: 0, g: 0, b: 0, a: 1}, + planes: [ + { + name: 'world', + plane: 'world', + camera: world_camera, + resolution: {width: 500, height: 500}, + presentation: 'letterbox', + clear: {r: 0.1, g: 0.1, b: 0.9, a: 1} + }, + { + name: 'hud', + plane: 'hud', + camera: hud_camera, + resolution: {width: 640, height: 360}, + presentation: 'integer_scale', + clear: {r: 0, g: 0, b: 0, a: 0}, + layer_sort: { + '100': 'y' // Bunny layer uses Y-sort + } + }, + { + name: 'ui', + plane: 'ui', + camera: hud_camera, + resolution: {width: 640, height: 360}, + presentation: 'integer_scale', + clear: null + } + ], + group_effects +} + +function init_game() { + // Cleanup old sprites + var i = 0 + for (i = 0; i < length(sprites); i++) + sprites[i].destroy() + sprites = [] + emitters = [] + bunnies = [] + + // World sprites + + // Background Tilemap + var tiles = [] + var x = 0 + var y = 0 + for (x = 0; x < 5; x++) { + tiles[x] = [] + for (y = 0; y < 5; y++) { + tiles[x][y] = 'examples/tiles/terrain_dirt_cloud' + } + } + + sprites[] = tilemap2d({ + plane: 'world', + layer: 0, + tiles: tiles, + tile_width: 1, + tile_height: 1, + offset_x: 0, + offset_y: 0 + }) + + sprites[] = sprite({ + plane: 'world', + layer: 10, + image: 'examples/enemies/saw_a', + pos: {x: 1, y: 1}, + anchor_x: 0.5, + }) + + // HUD sprites + sprites[] = text2d({ + plane: 'hud', + groups: ['mask_text'], // Effect routing only + layer: 50, + text: 'PALADIN', + pos: {x: 640/2 - 270, y: 360/2}, + font: 'examples/fonts/dos', + size: 150 + }) + + var masked_fire = particles2d.create({ + plane: 'hud', + groups: ['masked_fire'], // Effect routing only + layer: 40, + image: 'examples/tiles/fireball', + width: 40, + height: 40 + }) + sprites[] = masked_fire + emitters[] = particles2d.emitters.create({ + pos: {x: 320, y: 180}, + spawn_area: {width: 500, height: 200}, + velocity: {x: 0, y: 50}, + velocity_var: {x: 30, y: 30}, + life: 2, + rate: 60, + scale: 3, + scale_var: 0.3, + color: {r: 1, g: 0.6, b: 0.2}, + handle: masked_fire + }) + + sprites[] = sprite({ + plane: 'hud', + groups: ['corner_mask'], // Effect routing only + layer: 60, + image: 'examples/tiles/fireball', + pos: {x: 600, y: 40}, + width: 50, + height: 50, + anchor_x: 0.5, + anchor_y: 0.5 + }) + + var corner_fire = particles2d.create({ + plane: 'hud', + groups: ['corner_fire'], // Effect routing only + layer: 70, + image: 'examples/tiles/fireball', + width: 25, + height: 25 + }) + sprites[] = corner_fire + emitters[] = particles2d.emitters.create({ + pos: {x: 600, y: 40}, + spawn_area: {width: 30, height: 30}, + velocity: {x: 0, y: 30}, + velocity_var: {x: 20, y: 20}, + life: 1.5, + rate: 10, + scale: 1, + scale_var: 0.2, + color: {r: 1, g: 0.5, b: 0.1}, + handle: corner_fire + }) + + var bloom_fire = particles2d.create({ + plane: 'hud', + groups: ['bloom'], // Effect routing only + layer: 80, + image: 'examples/tiles/fireball', + width: 48, + height: 48 + }) + sprites[] = bloom_fire + emitters[] = particles2d.emitters.create({ + pos: {x: 100, y: 100}, + spawn_area: {width: 50, height: 50}, + velocity: {x: 100, y: 0}, + velocity_var: {x: 40, y: 40}, + life: 2.5, + rate: 12, + scale: 1.2, + scale_var: 0.4, + color: {r: 1, g: 0.8, b: 0.3}, + handle: bloom_fire + }) + + // Bouncing bunnies - exactly two, big, bottom of screen, Y-sort layer 100 + var bunny = null + for (i = 0; i < 2; i++) { + bunny = sprite({ + plane: 'hud', + layer: 100, // This layer has Y-sort enabled + image: 'examples/bunny', + pos: {x: 320 + (i == 0 ? -20 : 20), y: 340}, + width: 96, + height: 96, + anchor_x: 0.5, + }) + + bunny._base_y = 340 + bunny._t = i * 0.7 // phase offset so they don’t match + bunny._amp = 240 // bounce height in pixels + bunny._speed = 1 * random() // bounce speed + sprites[] = bunny + bunnies[] = bunny + } + + + log.console("World initialized - " + text(length(film2d.query({}))) + " drawables") +} +var json = use('json') +var last_time = 0 + +function update(dt) { + // Update all particle emitters + var i = 0 + for (i = 0; i < length(emitters); i++) + particles2d.emitters.update(emitters[i], dt) + + // Update bouncing bunnies + // Update bouncing bunnies (vertical bob only) + var b = null + var cycle = null + var u = null + for (i = 0; i < length(bunnies); i++) { + b = bunnies[i] + b._t += dt + + // Bob between base_y and base_y - amp using triangle wave + cycle = (b._t * b._speed) % 2 + u = cycle < 1 ? cycle : 2 - cycle + b.pos.y = b._base_y - u * b._amp + + // Optional: if your Y-sort uses an explicit key, keep it in sync + // b.y_sort_key = b.pos.y + } + +} + +function render() { + // 1. Build Clay UI + var clay_tree = clay.layout(function() { + clay.vstack({gap: 10, padding: 20, align: 'center'}, function() { + clay.text("Clay UI Sample", {font_size: 24, color: {r:1,g:1,b:0}}) + clay.image('examples/tiles/key_blue', {size:{width:32,height:32}, color: {r:1,g:0,b:0}}) + clay.container({size: [200, 100], background_color: {r:0.2, g:0.2, b:0.2, a:0.8}, padding: 10}, function() { + clay.vstack(function() { + clay.text("List Item 1") + clay.text("List Item 2") + clay.text("List Item 3") + }) + }) + }) + }, {width: 640, height: 360}) + + // Assign clay drawables to UI plane + compositor_config.planes[2].drawables = clay_tree.drawables + compositor_config.planes[2].clear = {r: 0, g: 0, b: 0, a: 0} + + var plan = compositor.compile(compositor_config) + + return compositor.execute(plan) +} + +init_game() + +core.start({ + width: 1280, + height: 720, + title: "Paladin - Data Oriented", + framerate: 60, + update: update, + render: render, + editor: function(ui) { + } +}) diff --git a/examples/paladin_simple.ce b/examples/paladin_simple.ce new file mode 100644 index 00000000..d4fb2d89 --- /dev/null +++ b/examples/paladin_simple.ce @@ -0,0 +1,99 @@ +// paladin_simple.ce - Simple test for prosperon rendering + +log.console("paladin simple test starting") + +var sprite = use('sprite') +var clay = use('clay') +var core = use('core') +var fx_graph = use('fx_graph') +var sdl_gpu = use('sdl_gpu') + +var fcfg = {font_path: 'examples/fonts/dos'} + +core.start({ + width: 640, + height: 480, + title: "Paladin Simple", + framerate: 60, + update: function(dt) {}, + render: build_render_graph, + input: function(ev) { + if (ev.type == 'quit') $stop() + } +}) + +function build_render_graph() { + var win_size = core.window_size() + var graph = fx_graph.create() + + // Simple sprite scene + var scene = { + type: 'group', + children: [{ + type: 'sprite', + image: 'examples/tiles/fireball', + pos: {x: win_size.width / 2, y: win_size.height / 2}, + width: win_size.height / 2, // Half screen height + height: win_size.height / 2, + anchor_x: 0.5, + anchor_y: 0.5, + color: {r: 1, g: 1, b: 1, a: 1} + }] + } + + var camera = { + pos: [0, 0], + width: win_size.width, + height: win_size.height, + anchor: [0, 0], + ortho: true, + background: {r: 0.2, g: 0.2, b: 0.3, a: 1} + } + + // Render to screen + + var ui_scene = clay.layout(function() { + clay.container({padding: 20, contain: clay.contain.content}, function() { + // Top-left HUD panel + clay.vstack({ + background_image: 'examples/tiles/brick_brown', + slice: 0.33, + padding: 20, + spacing: 10, + width: 200 + }, function() { + clay.text("PALADIN UI", [{font_size: 24, color: {r:1, g:0.8, b:0.2, a:1}}, fcfg]) + + clay.hstack({spacing: 10}, function() { + clay.image('examples/tiles/hud_heart', {width: 24, height: 24}) + clay.text("x 3", [{font_size: 20}, fcfg]) + }) + + clay.button("PAUSE", function() { log.console("Pause clicked") }, fcfg) + + // Scissored scroll area test + clay.container({ + width: 160, height: 60, + background_color: {r:0, g:0, b:0, a:0.5}, + clipped: true + }, function() { + clay.vstack({offset: {x:0, y: -10}}, function() { + clay.text("Item 1", fcfg) + clay.text("Item 2", fcfg) + clay.text("Item 3", fcfg) + clay.text("Item 4", fcfg) + }) + }) + }) + }) + }, {width: win_size.width, height: win_size.height}) + + graph.add_node('render_view', { + root: ui_scene, + camera: {pos: [0, 0], width: win_size.width, height: win_size.height, anchor: [0, 0], ortho: true}, + target: 'screen', + clear_color: {r:0,g:0,b:0,a:0} // Cleared transparent + }) + + return graph +} diff --git a/examples/rope.jpg b/examples/rope.jpg new file mode 100644 index 00000000..6b5cf466 Binary files /dev/null and b/examples/rope.jpg differ diff --git a/examples/test_line2d.ce b/examples/test_line2d.ce new file mode 100644 index 00000000..867b9c5d --- /dev/null +++ b/examples/test_line2d.ce @@ -0,0 +1,315 @@ +log.console("test_line2d starting") + +var time = use('time') + +var core = use('core') +var line2d = use('line2d') +var compositor = use('compositor') +var film2d = use('film2d') +var math = use('math/radians') + +var lines = [] +var t = 0 + +var camera = { + pos: {x: 400, y: 300}, + width: 800, + height: 600, + anchor: {x: 0.5, y: 0.5} +} + +var compositor_config = { + clear: {r: 0.1, g: 0.1, b: 0.15, a: 1}, + planes: [ + { + name: 'main', + plane: 'main', + camera: camera, + resolution: {width: 800, height: 600}, + presentation: 'stretch', + clear: {r: 0.1, g: 0.1, b: 0.15, a: 1} + } + ] +} + +function init() { + // Row 1: Basic lines with different widths + + // Thin line + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 50, y: 550}, {x: 150, y: 520}, {x: 200, y: 560}], + width: 4, + tint: {r: 1, g: 0.3, b: 0.3, a: 1} + }) + + // Medium line + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 250, y: 550}, {x: 350, y: 520}, {x: 400, y: 560}], + width: 12, + tint: {r: 0.3, g: 1, b: 0.3, a: 1} + }) + + // Thick line + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 450, y: 550}, {x: 550, y: 520}, {x: 600, y: 560}], + width: 24, + tint: {r: 0.3, g: 0.3, b: 1, a: 1} + }) + + // Variable width line + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 650, y: 560}, {x: 700, y: 520}, {x: 750, y: 560}], + widths: [8, 24, 8], + tint: {r: 1, g: 1, b: 0.3, a: 1} + }) + + // Row 2: Textured ropes with different UV modes + + // Rope with repeat UV (default for ropes) + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 50, y: 450}, {x: 120, y: 420}, {x: 200, y: 440}, {x: 280, y: 400}], + width: 20, + image: 'examples/rope', + uv: { + mode: 'repeat', + u_per_unit: 1 / 32 + } + }) + + // Rope with stretch UV + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 320, y: 450}, {x: 400, y: 420}, {x: 480, y: 440}, {x: 560, y: 400}], + width: 20, + image: 'examples/rope', + uv: { + mode: 'stretch' + } + }) + + // Rope with per-segment UV + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 600, y: 450}, {x: 660, y: 420}, {x: 720, y: 440}, {x: 780, y: 400}], + width: 20, + image: 'examples/rope', + uv: { + mode: 'per_segment' + } + }) + + // Row 3: Cap styles + + // Butt cap (default) + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 80, y: 320}, {x: 180, y: 320}], + width: 20, + cap: 'butt', + tint: {r: 0.8, g: 0.5, b: 0.2, a: 1} + }) + + // Square cap + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 250, y: 320}, {x: 350, y: 320}], + width: 20, + cap: 'square', + tint: {r: 0.5, g: 0.8, b: 0.2, a: 1} + }) + + // Round cap + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 420, y: 320}, {x: 520, y: 320}], + width: 20, + cap: 'round', + tint: {r: 0.2, g: 0.5, b: 0.8, a: 1} + }) + + // Round cap with texture + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 590, y: 320}, {x: 750, y: 320}], + width: 24, + cap: 'round', + image: 'examples/rope' + }) + + // Row 4: Complex paths + + // Wavy line (will be animated) + var wave_points = [] + var i = 0 + for (i = 0; i < 12; i++) { + wave_points[] = { + x: 50 + i * 30, + y: 220 + math.sine(i * 0.8) * 30 + } + } + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: wave_points, + width: 14, + image: 'examples/rope', + uv: { + mode: 'repeat', + u_per_unit: 1 / 24 + } + }) + + // Spiral/coil + var spiral_points = [] + var angle = null + var radius = null + for (i = 0; i < 20; i++) { + angle = i * 0.5 + radius = 20 + i * 3 + spiral_points[] = { + x: 550 + math.cosine(angle) * radius, + y: 200 + math.sine(angle) * radius + } + } + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: spiral_points, + width: 10, + image: 'examples/rope', + uv: { + mode: 'repeat', + u_per_unit: 1 / 20 + } + }) + + // Row 5: Closed shapes and special cases + + // Closed triangle + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 80, y: 80}, {x: 140, y: 140}, {x: 20, y: 140}], + width: 8, + closed: true, + tint: {r: 1, g: 0.5, b: 0.8, a: 1} + }) + + // Closed pentagon + var pent_points = [] + for (i = 0; i < 5; i++) { + angle = i * (2 * 3.14159 / 5) - 3.14159 / 2 + pent_points[] = { + x: 220 + math.cosine(angle) * 50, + y: 110 + math.sine(angle) * 50 + } + } + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: pent_points, + width: 10, + closed: true, + image: 'examples/rope', + uv: { + mode: 'repeat', + u_per_unit: 1 / 30 + } + }) + + // Animated rope (will swing) + lines[] = line2d.polyline({ + plane: 'main', + layer: 1, + points: [{x: 400, y: 50}, {x: 400, y: 100}, {x: 400, y: 150}], + width: 16, + image: 'examples/rope', + uv: { + mode: 'repeat', + u_per_unit: 1 / 20 + } + }) + + // Fuse/wire with opacity gradient (simulated via tint) + lines[] = line2d.polyline({ + plane: 'main', + layer: 0, + points: [{x: 500, y: 80}, {x: 580, y: 60}, {x: 660, y: 100}, {x: 740, y: 70}], + width: 8, + image: 'examples/rope', + opacity: 0.7, + tint: {r: 1, g: 0.8, b: 0.4, a: 1} + }) + + log.console("test_line2d initialized with " + text(length(lines)) + " lines") +} + +function update(dt) { + t += dt + + // Animate the wavy line (index 11) + var pts = null + var i = 0 + if (lines[11]) { + pts = lines[11].points + for (i = 0; i < length(pts); i++) { + pts[i].y = 220 + math.sine(i * 0.8 + t * 2) * 30 + } + lines[11].set_points(pts) + } + + // Animate the hanging rope (index 15) - swing like a pendulum + var swing = null + if (lines[15]) { + swing = math.sine(t * 1.5) * 40 + pts = [ + {x: 400, y: 50}, + {x: 400 + swing * 0.5, y: 100}, + {x: 400 + swing, y: 150} + ] + lines[15].set_points(pts) + } + + // Animate UV offset on the spiral (index 12) for scrolling texture effect + if (lines[12]) { + lines[12].uv.u_offset = t * 0.5 + lines[12]._rebuild() + } + + // Pulse opacity on the fuse (index 16) + if (lines[16]) { + lines[16].opacity = 0.5 + 0.5 * math.sine(t * 3) + } +} + +function render() { + var plan = compositor.compile(compositor_config) + return compositor.execute(plan) +} + +init() + +core.start({ + width: 800, + height: 600, + title: "Test Line2D - Ropes and Lines", + framerate: 60, + update: update, + render: render +}) diff --git a/examples/test_particles.ce b/examples/test_particles.ce new file mode 100644 index 00000000..75229d30 --- /dev/null +++ b/examples/test_particles.ce @@ -0,0 +1,301 @@ +log.console("test_particles starting") + +var time = use('time') +var random = use('random').random + +var core = use('core') +var particles2d = use('particles2d') +var text2d = use('text2d') +var compositor = use('compositor') +var film2d = use('film2d') +var math = use('math/radians') + +var particle_handles = [] +var emitters = [] +var labels = [] +var t = 0 + +var camera = { + pos: {x: 250, y: 250}, + width: 500, + height: 500, + anchor: {x: 0.5, y: 0.5} +} + +var compositor_config = { + clear: {r: 0.05, g: 0.05, b: 0.1, a: 1}, + planes: [ + { + name: 'main', + plane: 'main', + camera: camera, + resolution: {width: 500, height: 500}, + presentation: 'stretch', + clear: {r: 0.05, g: 0.05, b: 0.1, a: 1} + } + ] +} + +function init() { + // Emitter 1: Normal particles (top-left) + var handle1 = particles2d.create({ + plane: 'main', + layer: 0, + image: 'examples/tiles/fireball', + width: 20, + height: 20 + }) + particle_handles[] = handle1 + emitters[] = particles2d.emitters.create({ + pos: {x: 100, y: 400}, + spawn_area: {width: 30, height: 10}, + velocity: {x: 0, y: 50}, + velocity_var: {x: 20, y: 10}, + life: 2, + rate: 15, + scale: 1, + scale_var: 0.2, + color: {r: 1, g: 0.8, b: 0.3}, + handle: handle1 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Normal", + pos: {x: 70, y: 480}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Emitter 2: Half opacity (top-center) + var handle2 = particles2d.create({ + plane: 'main', + layer: 0, + image: 'examples/tiles/fireball', + width: 20, + height: 20, + opacity: 0.5 + }) + particle_handles[] = handle2 + emitters[] = particles2d.emitters.create({ + pos: {x: 250, y: 400}, + spawn_area: {width: 30, height: 10}, + velocity: {x: 0, y: 50}, + velocity_var: {x: 20, y: 10}, + life: 2, + rate: 15, + scale: 1, + scale_var: 0.2, + color: {r: 1, g: 0.8, b: 0.3}, + handle: handle2 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Opacity 0.5", + pos: {x: 210, y: 480}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Emitter 3: Red tint (top-right) + var handle3 = particles2d.create({ + plane: 'main', + layer: 0, + image: 'examples/tiles/fireball', + width: 20, + height: 20, + tint: {r: 1, g: 0.2, b: 0.2, a: 1} + }) + particle_handles[] = handle3 + emitters[] = particles2d.emitters.create({ + pos: {x: 400, y: 400}, + spawn_area: {width: 30, height: 10}, + velocity: {x: 0, y: 50}, + velocity_var: {x: 20, y: 10}, + life: 2, + rate: 15, + scale: 1, + scale_var: 0.2, + color: {r: 1, g: 0.8, b: 0.3}, + handle: handle3 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Red Tint", + pos: {x: 370, y: 480}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Emitter 4: Blue tint (bottom-left) + var handle4 = particles2d.create({ + plane: 'main', + layer: 0, + image: 'examples/tiles/fireball', + width: 24, + height: 24, + tint: {r: 0.3, g: 0.5, b: 1, a: 1} + }) + particle_handles[] = handle4 + emitters[] = particles2d.emitters.create({ + pos: {x: 100, y: 200}, + spawn_area: {width: 40, height: 10}, + velocity: {x: 0, y: 60}, + velocity_var: {x: 30, y: 15}, + life: 2.5, + rate: 20, + scale: 1.2, + scale_var: 0.3, + color: {r: 1, g: 1, b: 1}, + handle: handle4 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Blue Tint", + pos: {x: 70, y: 280}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Emitter 5: Green tint + opacity (bottom-center) + var handle5 = particles2d.create({ + plane: 'main', + layer: 0, + image: 'examples/tiles/fireball', + width: 24, + height: 24, + tint: {r: 0.3, g: 1, b: 0.3, a: 1}, + opacity: 0.7 + }) + particle_handles[] = handle5 + emitters[] = particles2d.emitters.create({ + pos: {x: 250, y: 200}, + spawn_area: {width: 40, height: 10}, + velocity: {x: 0, y: 60}, + velocity_var: {x: 30, y: 15}, + life: 2.5, + rate: 20, + scale: 1.2, + scale_var: 0.3, + color: {r: 1, g: 1, b: 1}, + handle: handle5 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Green + 70%", + pos: {x: 210, y: 280}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Emitter 6: Animated tint (bottom-right) + var handle6 = particles2d.create({ + plane: 'main', + layer: 0, + image: 'examples/tiles/fireball', + width: 24, + height: 24, + tint: {r: 1, g: 1, b: 1, a: 1} + }) + particle_handles[] = handle6 + emitters[] = particles2d.emitters.create({ + pos: {x: 400, y: 200}, + spawn_area: {width: 40, height: 10}, + velocity: {x: 0, y: 60}, + velocity_var: {x: 30, y: 15}, + life: 2.5, + rate: 20, + scale: 1.2, + scale_var: 0.3, + color: {r: 1, g: 1, b: 1}, + handle: handle6 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Rainbow", + pos: {x: 370, y: 280}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Emitter 7: Animated opacity (center) + var handle7 = particles2d.create({ + plane: 'main', + layer: 0, + image: 'examples/tiles/fireball', + width: 32, + height: 32, + opacity: 1 + }) + particle_handles[] = handle7 + emitters[] = particles2d.emitters.create({ + pos: {x: 250, y: 80}, + spawn_area: {width: 60, height: 20}, + velocity: {x: 0, y: 40}, + velocity_var: {x: 40, y: 20}, + life: 3, + rate: 25, + scale: 1.5, + scale_var: 0.4, + color: {r: 1, g: 0.6, b: 0.2}, + handle: handle7 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Pulsing Opacity", + pos: {x: 180, y: 20}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 0, a: 1} + }) + + log.console("test_particles initialized with " + text(length(emitters)) + " emitters") +} + +function update(dt) { + t += dt + + // Update all emitters + var i = 0 + for (i = 0; i < length(emitters); i++) { + particles2d.emitters.update(emitters[i], dt) + } + + // Animate rainbow tint on emitter 6 + var rainbow_handle = particle_handles[5] + rainbow_handle.tint.r = 0.5 + 0.5 * math.sine(t * 2) + rainbow_handle.tint.g = 0.5 + 0.5 * math.sine(t * 2 + 2.094) + rainbow_handle.tint.b = 0.5 + 0.5 * math.sine(t * 2 + 4.188) + + // Animate pulsing opacity on emitter 7 + var pulsing_handle = particle_handles[6] + pulsing_handle.opacity = 0.3 + 0.7 * abs(math.sine(t * 1.5)) +} + +function render() { + var plan = compositor.compile(compositor_config) + return compositor.execute(plan) +} + +init() + +core.start({ + width: 500, + height: 500, + title: "Test Particles Features", + framerate: 60, + update: update, + render: render +}) diff --git a/examples/test_shape2d.ce b/examples/test_shape2d.ce new file mode 100644 index 00000000..924a6d09 --- /dev/null +++ b/examples/test_shape2d.ce @@ -0,0 +1,352 @@ +log.console("test_shape2d starting") + +var time = use('time') + +var core = use('core') +var shape2d = use('shape2d') +var compositor = use('compositor') +var film2d = use('film2d') +var math = use('math/radians') + +var shapes = [] +var t = 0 + +var camera = { + pos: {x: 400, y: 300}, + width: 800, + height: 600, + anchor: {x: 0.5, y: 0.5} +} + +var compositor_config = { + clear: {r: 0.1, g: 0.1, b: 0.15, a: 1}, + planes: [ + { + name: 'main', + plane: 'main', + camera: camera, + resolution: {width: 800, height: 600}, + presentation: 'stretch', + clear: {r: 0.1, g: 0.1, b: 0.15, a: 1} + } + ] +} + +function init() { + // Row 1: Basic shapes - rect, circle, ellipse, pill + + // Rectangle with rounded corners + shapes[] = shape2d.rect({ + plane: 'main', + layer: 0, + pos: {x: 100, y: 500}, + width: 120, + height: 80, + radius: 10, + fill: {r: 0.2, g: 0.6, b: 0.9, a: 1} + }) + + // Circle + shapes[] = shape2d.circle({ + plane: 'main', + layer: 0, + pos: {x: 250, y: 500}, + radius: 50, + fill: {r: 0.9, g: 0.3, b: 0.3, a: 1} + }) + + // Ellipse + shapes[] = shape2d.ellipse({ + plane: 'main', + layer: 0, + pos: {x: 400, y: 500}, + width: 140, + height: 80, + fill: {r: 0.3, g: 0.9, b: 0.4, a: 1} + }) + + // Pill (stadium) + shapes[] = shape2d.pill({ + plane: 'main', + layer: 0, + pos: {x: 550, y: 500}, + width: 140, + height: 60, + fill: {r: 0.9, g: 0.7, b: 0.2, a: 1} + }) + + // Row 2: Stroke variations + + // Rect with stroke only + shapes[] = shape2d.rect({ + plane: 'main', + layer: 0, + pos: {x: 100, y: 380}, + width: 100, + height: 80, + radius: 5, + fill: {r: 0, g: 0, b: 0, a: 0}, + stroke: {r: 1, g: 1, b: 1, a: 1}, + stroke_thickness: 3, + stroke_align: 'center', + dash_len: 14, + gap_len: 6 + }) + + // Circle with thick stroke + shapes[] = shape2d.circle({ + plane: 'main', + layer: 0, + pos: {x: 250, y: 380}, + radius: 45, + fill: {r: 0.2, g: 0.2, b: 0.3, a: 1}, + stroke: {r: 0.5, g: 0.8, b: 1, a: 1}, + stroke_thickness: 6, + stroke_align: 'outside', + dash_len: 14, + gap_len: 6 + }) + + // Ellipse with inside stroke + shapes[] = shape2d.ellipse({ + plane: 'main', + layer: 0, + pos: {x: 400, y: 380}, + width: 120, + height: 70, + fill: {r: 0.4, g: 0.2, b: 0.5, a: 1}, + stroke: {r: 1, g: 0.5, b: 0.8, a: 1}, + stroke_thickness: 4, + stroke_align: 'inside', + dash_len: 14, + gap_len: 6 + }) + + // Pill with dashed stroke + shapes[] = shape2d.pill({ + plane: 'main', + layer: 0, + pos: {x: 550, y: 380}, + width: 130, + height: 50, + fill: {r: 0.1, g: 0.3, b: 0.2, a: 1}, + stroke: {r: 0.3, g: 1, b: 0.5, a: 1}, + stroke_thickness: 3, + dash_len: 15, + gap_len: 8 + }) + + // Row 3: Feather / soft edges + + // Soft rect + shapes[] = shape2d.rect({ + plane: 'main', + layer: 0, + pos: {x: 100, y: 260}, + width: 100, + height: 80, + radius: 20, + fill: {r: 0.8, g: 0.4, b: 0.1, a: 1}, + feather: 10 + }) + + // Soft circle (glow effect) + shapes[] = shape2d.circle({ + plane: 'main', + layer: 0, + pos: {x: 250, y: 260}, + radius: 40, + fill: {r: 1, g: 0.9, b: 0.3, a: 1}, + feather: 20 + }) + + // Soft ellipse + shapes[] = shape2d.ellipse({ + plane: 'main', + layer: 0, + pos: {x: 400, y: 260}, + width: 120, + height: 60, + fill: {r: 0.3, g: 0.5, b: 1, a: 0.8}, + feather: 15 + }) + + // Sharp vs soft comparison + shapes[] = shape2d.pill({ + plane: 'main', + layer: 0, + pos: {x: 550, y: 260}, + width: 120, + height: 50, + fill: {r: 1, g: 0.2, b: 0.6, a: 1}, + feather: 5 + }) + + // Row 4: Opacity and blending + + // Semi-transparent overlapping shapes + shapes[] = shape2d.rect({ + plane: 'main', + layer: 0, + pos: {x: 80, y: 130}, + width: 100, + height: 80, + fill: {r: 1, g: 0, b: 0, a: 0.6}, + opacity: 1 + }) + + shapes[] = shape2d.rect({ + plane: 'main', + layer: 1, + pos: {x: 120, y: 130}, + width: 100, + height: 80, + fill: {r: 0, g: 1, b: 0, a: 0.6}, + opacity: 1 + }) + + shapes[] = shape2d.rect({ + plane: 'main', + layer: 2, + pos: {x: 100, y: 150}, + width: 100, + height: 80, + fill: {r: 0, g: 0, b: 1, a: 0.6}, + opacity: 1 + }) + + // Animated opacity circle + shapes[] = shape2d.circle({ + plane: 'main', + layer: 0, + pos: {x: 280, y: 130}, + radius: 50, + fill: {r: 1, g: 1, b: 1, a: 1}, + opacity: 1 + }) + + // Different corner radii + shapes[] = shape2d.rect({ + plane: 'main', + layer: 0, + pos: {x: 420, y: 130}, + width: 100, + height: 80, + radius: 0, + fill: {r: 0.5, g: 0.5, b: 0.5, a: 1} + }) + + shapes[] = shape2d.rect({ + plane: 'main', + layer: 0, + pos: {x: 540, y: 130}, + width: 100, + height: 80, + radius: 20, + fill: {r: 0.6, g: 0.6, b: 0.6, a: 1} + }) + + shapes[] = shape2d.rect({ + plane: 'main', + layer: 0, + pos: {x: 660, y: 130}, + width: 100, + height: 80, + radius: 40, + fill: {r: 0.7, g: 0.7, b: 0.7, a: 1} + }) + + // Row 5: Large decorative shapes + + // Background panel + shapes[] = shape2d.rect({ + plane: 'main', + layer: -1, + pos: {x: 700, y: 400}, + width: 160, + height: 350, + radius: 15, + fill: {r: 0.15, g: 0.15, b: 0.2, a: 1}, + stroke: {r: 0.3, g: 0.3, b: 0.4, a: 1}, + stroke_thickness: 2 + }) + + // Decorative circles inside panel + shapes[] = shape2d.circle({ + plane: 'main', + layer: 0, + pos: {x: 700, y: 500}, + radius: 30, + fill: {r: 0.8, g: 0.2, b: 0.3, a: 1} + }) + + shapes[] = shape2d.circle({ + plane: 'main', + layer: 0, + pos: {x: 700, y: 420}, + radius: 25, + fill: {r: 0.2, g: 0.8, b: 0.3, a: 1} + }) + + shapes[] = shape2d.circle({ + plane: 'main', + layer: 0, + pos: {x: 700, y: 350}, + radius: 20, + fill: {r: 0.2, g: 0.3, b: 0.8, a: 1} + }) + + log.console("test_shape2d initialized with " + text(length(shapes)) + " shapes") +} + +function update(dt) { + t += dt + + // Animate opacity on the white circle (index 16) + if (shapes[16]) { + shapes[16].opacity = 0.3 + 0.7 * (0.5 + 0.5 * math.sine(t * 2)) + } + + // Animate the glow circle size (index 10) + var scale = null + if (shapes[10]) { + scale = 1 + 0.2 * math.sine(t * 3) + shapes[10].width = 80 * scale + shapes[10].height = 80 * scale + } + + // Rotate the dashed pill stroke (index 7) + if (shapes[7]) { + shapes[4].dash_offset = t * 30 + shapes[5].dash_offset = t * 30 + shapes[6].dash_offset = t * 30 + shapes[7].dash_offset = t * 30 + } + + // Pulse the decorative circles + if (shapes[21]) { + shapes[21].fill.r = 0.5 + 0.5 * math.sine(t * 1.5) + } + if (shapes[22]) { + shapes[22].fill.g = 0.5 + 0.5 * math.sine(t * 1.5 + 2.094) + } + if (shapes[23]) { + shapes[23].fill.b = 0.5 + 0.5 * math.sine(t * 1.5 + 4.188) + } +} + +function render() { + var plan = compositor.compile(compositor_config) + return compositor.execute(plan) +} + +init() + +core.start({ + width: 800, + height: 600, + title: "Test Shape2D - SDF Shapes", + framerate: 60, + update: update, + render: render +}) diff --git a/examples/test_sprite.ce b/examples/test_sprite.ce new file mode 100644 index 00000000..32f3b913 --- /dev/null +++ b/examples/test_sprite.ce @@ -0,0 +1,206 @@ +log.console("test_sprite starting") + +var time = use('time') + +var core = use('core') +var sprite = use('sprite') +var compositor = use('compositor') +var film2d = use('film2d') +var math = use('math/radians') + +var sprites = [] +var t = 0 + +var camera = { + pos: {x: 250, y: 250}, + width: 500, + height: 500, + anchor: {x: 0.5, y: 0.5} +} + +var compositor_config = { + clear: {r: 0.1, g: 0.1, b: 0.15, a: 1}, + planes: [ + { + name: 'main', + plane: 'main', + camera: camera, + resolution: {width: 500, height: 500}, + presentation: 'stretch', + clear: {r: 0.1, g: 0.1, b: 0.15, a: 1} + } + ] +} + +function init() { + // Row 1: Opacity test - 0, 0.25, 0.5, 0.75, 1.0 + var i = 0 + for (i = 0; i < 5; i++) { + sprites[] = sprite({ + plane: 'main', + layer: 0, + image: 'examples/bunny', + pos: {x: 50 + i * 100, y: 450}, + width: 64, + height: 64, + anchor_x: 0.5, + anchor_y: 0.5, + opacity: i * 0.25 + }) + } + + // Row 2: Tint test - red, green, blue, yellow, magenta + var tints = [ + {r: 1, g: 0, b: 0, a: 1}, + {r: 0, g: 1, b: 0, a: 1}, + {r: 0, g: 0, b: 1, a: 1}, + {r: 1, g: 1, b: 0, a: 1}, + {r: 1, g: 0, b: 1, a: 1} + ] + for (i = 0; i < 5; i++) { + sprites[] = sprite({ + plane: 'main', + layer: 0, + image: 'examples/bunny', + pos: {x: 50 + i * 100, y: 350}, + width: 64, + height: 64, + anchor_x: 0.5, + anchor_y: 0.5, + tint: tints[i] + }) + } + + // Row 3: Filter test - nearest (small scaled up) vs linear (small scaled up) + sprites[] = sprite({ + plane: 'main', + layer: 0, + image: 'examples/bunny', + pos: {x: 125, y: 250}, + width: 150, + height: 150, + anchor_x: 0.5, + anchor_y: 0.5, + filter: 'nearest' + }) + sprites[] = sprite({ + plane: 'main', + layer: 0, + image: 'examples/bunny', + pos: {x: 375, y: 250}, + width: 150, + height: 150, + anchor_x: 0.5, + anchor_y: 0.5, + filter: 'linear' + }) + + // Row 4: Flip test - normal, flip_x, flip_y, flip_both + sprites[] = sprite({ + plane: 'main', + layer: 0, + image: 'examples/bunny', + pos: {x: 75, y: 125}, + width: 64, + height: 64, + anchor_x: 0.5, + anchor_y: 0.5, + flip: {x: false, y: false} + }) + sprites[] = sprite({ + plane: 'main', + layer: 0, + image: 'examples/bunny', + pos: {x: 175, y: 125}, + width: 64, + height: 64, + anchor_x: 0.5, + anchor_y: 0.5, + flip: {x: true, y: false} + }) + sprites[] = sprite({ + plane: 'main', + layer: 0, + image: 'examples/bunny', + pos: {x: 275, y: 125}, + width: 64, + height: 64, + anchor_x: 0.5, + anchor_y: 0.5, + flip: {x: false, y: true} + }) + sprites[] = sprite({ + plane: 'main', + layer: 0, + image: 'examples/bunny', + pos: {x: 375, y: 125}, + width: 64, + height: 64, + anchor_x: 0.5, + anchor_y: 0.5, + flip: {x: true, y: true} + }) + + // Row 5: UV scroll test - animated texture offset + sprites[] = sprite({ + plane: 'main', + layer: 0, + image: 'examples/bunny', + pos: {x: 450, y: 125}, + width: 64, + height: 64, + anchor_x: 0.5, + anchor_y: 0.5, + uv: {offset: {x: 0, y: 0}, scale: {x: 1, y: 1}, rotate: 0} + }) + + // Animated opacity sprite + sprites[] = sprite({ + plane: 'main', + layer: 1, + image: 'examples/bunny', + pos: {x: 250, y: 50}, + width: 80, + height: 80, + anchor_x: 0.5, + anchor_y: 0.5, + opacity: 1 + }) + + log.console("test_sprite initialized with " + text(length(sprites)) + " sprites") +} + +function update(dt) { + t += dt + + // Animate opacity on the last sprite (pulsing) + var animated_opacity_sprite = sprites[length(sprites) - 1] + animated_opacity_sprite.opacity = 0.5 + 0.5 * math.sine(t * 2) + + // Animate UV scroll on the UV test sprite + var uv_sprite = sprites[length(sprites) - 2] + uv_sprite.uv.offset.x = (t * 0.5) % 1 + uv_sprite.uv.offset.y = (t * 0.3) % 1 + + // Animate tint on first tint sprite (cycling hue) + var tint_sprite = sprites[5] + tint_sprite.tint.r = 0.5 + 0.5 * math.sine(t * 1.5) + tint_sprite.tint.g = 0.5 + 0.5 * math.sine(t * 1.5 + 2.094) + tint_sprite.tint.b = 0.5 + 0.5 * math.sine(t * 1.5 + 4.188) +} + +function render() { + var plan = compositor.compile(compositor_config) + return compositor.execute(plan) +} + +init() + +core.start({ + width: 500, + height: 500, + title: "Test Sprite Features", + framerate: 60, + update: update, + render: render +}) diff --git a/examples/test_text.ce b/examples/test_text.ce new file mode 100644 index 00000000..c1194964 --- /dev/null +++ b/examples/test_text.ce @@ -0,0 +1,256 @@ +log.console("test_text starting") + +var time = use('time') + +var core = use('core') +var text2d = use('text2d') +var compositor = use('compositor') +var film2d = use('film2d') +var math = use('math/radians') + +var texts = [] +var t = 0 + +var camera = { + pos: {x: 250, y: 250}, + width: 500, + height: 500, + anchor: {x: 0.5, y: 0.5} +} + +var compositor_config = { + clear: {r: 0.1, g: 0.1, b: 0.15, a: 1}, + planes: [ + { + name: 'main', + plane: 'main', + camera: camera, + resolution: {width: 500, height: 500}, + presentation: 'stretch', + clear: {r: 0.1, g: 0.1, b: 0.15, a: 1} + } + ] +} + +function init() { + // Row 1: Normal text + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Normal Text", + pos: {x: 20, y: 470}, + font: 'examples/fonts/dos', + size: 24, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Row 2: Opacity variations + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Opacity 0.25", + pos: {x: 20, y: 420}, + font: 'examples/fonts/dos', + size: 20, + color: {r: 1, g: 1, b: 1, a: 1}, + opacity: 0.25 + }) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Opacity 0.5", + pos: {x: 200, y: 420}, + font: 'examples/fonts/dos', + size: 20, + color: {r: 1, g: 1, b: 1, a: 1}, + opacity: 0.5 + }) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Opacity 0.75", + pos: {x: 360, y: 420}, + font: 'examples/fonts/dos', + size: 20, + color: {r: 1, g: 1, b: 1, a: 1}, + opacity: 0.75 + }) + + // Row 3: Tint colors + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Red Tint", + pos: {x: 20, y: 360}, + font: 'examples/fonts/dos', + size: 24, + color: {r: 1, g: 1, b: 1, a: 1}, + tint: {r: 1, g: 0.2, b: 0.2, a: 1} + }) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Green Tint", + pos: {x: 180, y: 360}, + font: 'examples/fonts/dos', + size: 24, + color: {r: 1, g: 1, b: 1, a: 1}, + tint: {r: 0.2, g: 1, b: 0.2, a: 1} + }) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Blue Tint", + pos: {x: 360, y: 360}, + font: 'examples/fonts/dos', + size: 24, + color: {r: 1, g: 1, b: 1, a: 1}, + tint: {r: 0.2, g: 0.2, b: 1, a: 1} + }) + + // Row 4: Combined tint + opacity + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Yellow + 50% Opacity", + pos: {x: 20, y: 300}, + font: 'examples/fonts/dos', + size: 20, + color: {r: 1, g: 1, b: 1, a: 1}, + tint: {r: 1, g: 1, b: 0, a: 1}, + opacity: 0.5 + }) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Cyan + 75% Opacity", + pos: {x: 280, y: 300}, + font: 'examples/fonts/dos', + size: 20, + color: {r: 1, g: 1, b: 1, a: 1}, + tint: {r: 0, g: 1, b: 1, a: 1}, + opacity: 0.75 + }) + + // Row 5: Different sizes + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Small", + pos: {x: 20, y: 240}, + font: 'examples/fonts/dos', + size: 12, + color: {r: 1, g: 1, b: 1, a: 1} + }) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Medium", + pos: {x: 100, y: 240}, + font: 'examples/fonts/dos', + size: 20, + color: {r: 1, g: 1, b: 1, a: 1} + }) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Large", + pos: {x: 220, y: 240}, + font: 'examples/fonts/dos', + size: 32, + color: {r: 1, g: 1, b: 1, a: 1} + }) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "XL", + pos: {x: 360, y: 240}, + font: 'examples/fonts/dos', + size: 48, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Row 6: Animated text (pulsing opacity) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Pulsing Opacity", + pos: {x: 150, y: 150}, + font: 'examples/fonts/dos', + size: 28, + color: {r: 1, g: 1, b: 1, a: 1}, + opacity: 1 + }) + + // Row 7: Animated tint (rainbow cycle) + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "Rainbow Tint", + pos: {x: 150, y: 100}, + font: 'examples/fonts/dos', + size: 28, + color: {r: 1, g: 1, b: 1, a: 1}, + tint: {r: 1, g: 0, b: 0, a: 1} + }) + + // Row 8: Typewriter effect simulation + texts[] = text2d({ + plane: 'main', + layer: 0, + text: "", + pos: {x: 20, y: 50}, + font: 'examples/fonts/dos', + size: 20, + color: {r: 0.8, g: 1, b: 0.8, a: 1} + }) + + log.console("test_text initialized with " + text(length(texts)) + " text elements") +} + +var typewriter_text = "Hello, this is a typewriter effect demo..." +var typewriter_index = 0 +var typewriter_timer = 0 + +function update(dt) { + t += dt + + // Animate pulsing opacity + var pulsing_text = texts[length(texts) - 3] + pulsing_text.opacity = 0.3 + 0.7 * abs(math.sine(t * 2)) + + // Animate rainbow tint + var rainbow_text = texts[length(texts) - 2] + rainbow_text.tint.r = 0.5 + 0.5 * math.sine(t * 2) + rainbow_text.tint.g = 0.5 + 0.5 * math.sine(t * 2 + 2.094) + rainbow_text.tint.b = 0.5 + 0.5 * math.sine(t * 2 + 4.188) + + // Typewriter effect + typewriter_timer += dt + var typewriter = null + if (typewriter_timer > 0.08) { + typewriter_timer = 0 + typewriter_index++ + if (typewriter_index > length(typewriter_text)) { + typewriter_index = 0 + } + typewriter = texts[length(texts) - 1] + typewriter.text = text(typewriter_text, 0, typewriter_index) + } +} + +function render() { + var plan = compositor.compile(compositor_config) + return compositor.execute(plan) +} + +init() + +core.start({ + width: 500, + height: 500, + title: "Test Text Features", + framerate: 60, + update: update, + render: render +}) diff --git a/examples/test_tilemap.ce b/examples/test_tilemap.ce new file mode 100644 index 00000000..cd6b622a --- /dev/null +++ b/examples/test_tilemap.ce @@ -0,0 +1,187 @@ +log.console("test_tilemap starting") + +var time = use('time') + +var core = use('core') +var tilemap2d = use('tilemap2d') +var text2d = use('text2d') +var compositor = use('compositor') +var film2d = use('film2d') +var math = use('math/radians') + +var tilemaps = [] +var labels = [] +var t = 0 + +var camera = { + pos: {x: 250, y: 250}, + width: 500, + height: 500, + anchor: {x: 0.5, y: 0.5} +} + +var compositor_config = { + clear: {r: 0.05, g: 0.05, b: 0.1, a: 1}, + planes: [ + { + name: 'main', + plane: 'main', + camera: camera, + resolution: {width: 500, height: 500}, + presentation: 'stretch', + clear: {r: 0.05, g: 0.05, b: 0.1, a: 1} + } + ] +} + +function make_grid(w, h, img) { + var tiles = [] + var x = 0 + var y = 0 + for (x = 0; x < w; x++) { + tiles[x] = [] + for (y = 0; y < h; y++) { + tiles[x][y] = img + } + } + return tiles +} + +function init() { + // Tilemap 1: Normal (top-left) + tilemaps[] = tilemap2d({ + plane: 'main', + layer: 0, + tiles: make_grid(4, 4, 'examples/tiles/terrain_dirt_cloud'), + tile_width: 25, + tile_height: 25, + offset_x: 0, + offset_y: 14 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Normal", + pos: {x: 50, y: 480}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Tilemap 2: Opacity 0.5 (top-right) + tilemaps[] = tilemap2d({ + plane: 'main', + layer: 0, + tiles: make_grid(4, 4, 'examples/tiles/terrain_dirt_cloud'), + tile_width: 25, + tile_height: 25, + offset_x: 10, + offset_y: 14, + opacity: 0.5 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Opacity 0.5", + pos: {x: 280, y: 480}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Tilemap 3: Red tint (bottom-left) + tilemaps[] = tilemap2d({ + plane: 'main', + layer: 0, + tiles: make_grid(4, 4, 'examples/tiles/terrain_dirt_cloud'), + tile_width: 25, + tile_height: 25, + offset_x: 0, + offset_y: 4, + tint: {r: 1, g: 0.3, b: 0.3, a: 1} + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Red Tint", + pos: {x: 50, y: 230}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Tilemap 4: Green tint (bottom-right) + tilemaps[] = tilemap2d({ + plane: 'main', + layer: 0, + tiles: make_grid(4, 4, 'examples/tiles/terrain_dirt_cloud'), + tile_width: 25, + tile_height: 25, + offset_x: 10, + offset_y: 4, + tint: {r: 0.3, g: 1, b: 0.3, a: 1} + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Green Tint", + pos: {x: 280, y: 230}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 1, a: 1} + }) + + // Tilemap 5: Animated opacity (center bottom) + tilemaps[] = tilemap2d({ + plane: 'main', + layer: 0, + tiles: make_grid(3, 3, 'examples/tiles/terrain_dirt_cloud'), + tile_width: 30, + tile_height: 30, + offset_x: 6, + offset_y: 0, + opacity: 1 + }) + labels[] = text2d({ + plane: 'main', + layer: 10, + text: "Animated Opacity", + pos: {x: 180, y: 20}, + font: 'examples/fonts/dos', + size: 14, + color: {r: 1, g: 1, b: 0, a: 1} + }) + + log.console("test_tilemap initialized with " + text(length(tilemaps)) + " tilemaps") +} + +function update(dt) { + t += dt + + // Animate opacity on the center tilemap + var animated_tilemap = tilemaps[4] + animated_tilemap.opacity = 0.3 + 0.7 * abs(math.sine(t * 1.5)) + + // Animate tint on the red tilemap (pulse) + var red_tilemap = tilemaps[2] + var pulse = 0.5 + 0.5 * math.sine(t * 2) + red_tilemap.tint.r = 0.5 + 0.5 * pulse + red_tilemap.tint.g = 0.2 * pulse + red_tilemap.tint.b = 0.2 * pulse +} + +function render() { + var plan = compositor.compile(compositor_config) + return compositor.execute(plan) +} + +init() + +core.start({ + width: 500, + height: 500, + title: "Test Tilemap Features", + framerate: 60, + update: update, + render: render +}) diff --git a/examples/tiles/block_blue.png b/examples/tiles/block_blue.png new file mode 100644 index 00000000..4ec5cf5b Binary files /dev/null and b/examples/tiles/block_blue.png differ diff --git a/examples/tiles/block_coin.png b/examples/tiles/block_coin.png new file mode 100644 index 00000000..cbabce2d Binary files /dev/null and b/examples/tiles/block_coin.png differ diff --git a/examples/tiles/block_coin_active.png b/examples/tiles/block_coin_active.png new file mode 100644 index 00000000..22af29bc Binary files /dev/null and b/examples/tiles/block_coin_active.png differ diff --git a/examples/tiles/block_empty.png b/examples/tiles/block_empty.png new file mode 100644 index 00000000..c8b80e44 Binary files /dev/null and b/examples/tiles/block_empty.png differ diff --git a/examples/tiles/block_empty_warning.png b/examples/tiles/block_empty_warning.png new file mode 100644 index 00000000..7ed868cf Binary files /dev/null and b/examples/tiles/block_empty_warning.png differ diff --git a/examples/tiles/block_exclamation.png b/examples/tiles/block_exclamation.png new file mode 100644 index 00000000..fae233af Binary files /dev/null and b/examples/tiles/block_exclamation.png differ diff --git a/examples/tiles/block_exclamation_active.png b/examples/tiles/block_exclamation_active.png new file mode 100644 index 00000000..f80bbee3 Binary files /dev/null and b/examples/tiles/block_exclamation_active.png differ diff --git a/examples/tiles/block_green.png b/examples/tiles/block_green.png new file mode 100644 index 00000000..adce2395 Binary files /dev/null and b/examples/tiles/block_green.png differ diff --git a/examples/tiles/block_plank.png b/examples/tiles/block_plank.png new file mode 100644 index 00000000..26a07d50 Binary files /dev/null and b/examples/tiles/block_plank.png differ diff --git a/examples/tiles/block_planks.png b/examples/tiles/block_planks.png new file mode 100644 index 00000000..1f81028e Binary files /dev/null and b/examples/tiles/block_planks.png differ diff --git a/examples/tiles/block_red.png b/examples/tiles/block_red.png new file mode 100644 index 00000000..483bb3d0 Binary files /dev/null and b/examples/tiles/block_red.png differ diff --git a/examples/tiles/block_spikes.png b/examples/tiles/block_spikes.png new file mode 100644 index 00000000..1bdac719 Binary files /dev/null and b/examples/tiles/block_spikes.png differ diff --git a/examples/tiles/block_strong_coin.png b/examples/tiles/block_strong_coin.png new file mode 100644 index 00000000..59993dfa Binary files /dev/null and b/examples/tiles/block_strong_coin.png differ diff --git a/examples/tiles/block_strong_coin_active.png b/examples/tiles/block_strong_coin_active.png new file mode 100644 index 00000000..50c904dc Binary files /dev/null and b/examples/tiles/block_strong_coin_active.png differ diff --git a/examples/tiles/block_strong_danger.png b/examples/tiles/block_strong_danger.png new file mode 100644 index 00000000..3fd185ba Binary files /dev/null and b/examples/tiles/block_strong_danger.png differ diff --git a/examples/tiles/block_strong_danger_active.png b/examples/tiles/block_strong_danger_active.png new file mode 100644 index 00000000..04a2a4fb Binary files /dev/null and b/examples/tiles/block_strong_danger_active.png differ diff --git a/examples/tiles/block_strong_empty.png b/examples/tiles/block_strong_empty.png new file mode 100644 index 00000000..02025008 Binary files /dev/null and b/examples/tiles/block_strong_empty.png differ diff --git a/examples/tiles/block_strong_empty_active.png b/examples/tiles/block_strong_empty_active.png new file mode 100644 index 00000000..8e12a067 Binary files /dev/null and b/examples/tiles/block_strong_empty_active.png differ diff --git a/examples/tiles/block_strong_exclamation.png b/examples/tiles/block_strong_exclamation.png new file mode 100644 index 00000000..8d096f6f Binary files /dev/null and b/examples/tiles/block_strong_exclamation.png differ diff --git a/examples/tiles/block_strong_exclamation_active.png b/examples/tiles/block_strong_exclamation_active.png new file mode 100644 index 00000000..2a6d9624 Binary files /dev/null and b/examples/tiles/block_strong_exclamation_active.png differ diff --git a/examples/tiles/block_yellow.png b/examples/tiles/block_yellow.png new file mode 100644 index 00000000..2e4ce5c7 Binary files /dev/null and b/examples/tiles/block_yellow.png differ diff --git a/examples/tiles/bomb.png b/examples/tiles/bomb.png new file mode 100644 index 00000000..a725ae87 Binary files /dev/null and b/examples/tiles/bomb.png differ diff --git a/examples/tiles/bomb_active.png b/examples/tiles/bomb_active.png new file mode 100644 index 00000000..e84611ee Binary files /dev/null and b/examples/tiles/bomb_active.png differ diff --git a/examples/tiles/brick_brown.png b/examples/tiles/brick_brown.png new file mode 100644 index 00000000..c99b359d Binary files /dev/null and b/examples/tiles/brick_brown.png differ diff --git a/examples/tiles/brick_brown_diagonal.png b/examples/tiles/brick_brown_diagonal.png new file mode 100644 index 00000000..203e07dd Binary files /dev/null and b/examples/tiles/brick_brown_diagonal.png differ diff --git a/examples/tiles/brick_grey.png b/examples/tiles/brick_grey.png new file mode 100644 index 00000000..35b1d971 Binary files /dev/null and b/examples/tiles/brick_grey.png differ diff --git a/examples/tiles/brick_grey_diagonal.png b/examples/tiles/brick_grey_diagonal.png new file mode 100644 index 00000000..96935ea9 Binary files /dev/null and b/examples/tiles/brick_grey_diagonal.png differ diff --git a/examples/tiles/bricks_brown.png b/examples/tiles/bricks_brown.png new file mode 100644 index 00000000..914f3a21 Binary files /dev/null and b/examples/tiles/bricks_brown.png differ diff --git a/examples/tiles/bricks_grey.png b/examples/tiles/bricks_grey.png new file mode 100644 index 00000000..23c7384c Binary files /dev/null and b/examples/tiles/bricks_grey.png differ diff --git a/examples/tiles/bridge.png b/examples/tiles/bridge.png new file mode 100644 index 00000000..7f6d93af Binary files /dev/null and b/examples/tiles/bridge.png differ diff --git a/examples/tiles/bridge_logs.png b/examples/tiles/bridge_logs.png new file mode 100644 index 00000000..771f542d Binary files /dev/null and b/examples/tiles/bridge_logs.png differ diff --git a/examples/tiles/bush.png b/examples/tiles/bush.png new file mode 100644 index 00000000..71036352 Binary files /dev/null and b/examples/tiles/bush.png differ diff --git a/examples/tiles/cactus.png b/examples/tiles/cactus.png new file mode 100644 index 00000000..7834e903 Binary files /dev/null and b/examples/tiles/cactus.png differ diff --git a/examples/tiles/chain.png b/examples/tiles/chain.png new file mode 100644 index 00000000..0b5d5a02 Binary files /dev/null and b/examples/tiles/chain.png differ diff --git a/examples/tiles/coin_bronze.png b/examples/tiles/coin_bronze.png new file mode 100644 index 00000000..68a5cf74 Binary files /dev/null and b/examples/tiles/coin_bronze.png differ diff --git a/examples/tiles/coin_bronze_side.png b/examples/tiles/coin_bronze_side.png new file mode 100644 index 00000000..730646ec Binary files /dev/null and b/examples/tiles/coin_bronze_side.png differ diff --git a/examples/tiles/coin_gold.png b/examples/tiles/coin_gold.png new file mode 100644 index 00000000..344397eb Binary files /dev/null and b/examples/tiles/coin_gold.png differ diff --git a/examples/tiles/coin_gold_side.png b/examples/tiles/coin_gold_side.png new file mode 100644 index 00000000..66dc0444 Binary files /dev/null and b/examples/tiles/coin_gold_side.png differ diff --git a/examples/tiles/coin_silver.png b/examples/tiles/coin_silver.png new file mode 100644 index 00000000..f6d57ca5 Binary files /dev/null and b/examples/tiles/coin_silver.png differ diff --git a/examples/tiles/coin_silver_side.png b/examples/tiles/coin_silver_side.png new file mode 100644 index 00000000..b1577581 Binary files /dev/null and b/examples/tiles/coin_silver_side.png differ diff --git a/examples/tiles/conveyor.png b/examples/tiles/conveyor.png new file mode 100644 index 00000000..e7e82461 Binary files /dev/null and b/examples/tiles/conveyor.png differ diff --git a/examples/tiles/door_closed.png b/examples/tiles/door_closed.png new file mode 100644 index 00000000..8d0bb88e Binary files /dev/null and b/examples/tiles/door_closed.png differ diff --git a/examples/tiles/door_closed_top.png b/examples/tiles/door_closed_top.png new file mode 100644 index 00000000..5fb7ee0a Binary files /dev/null and b/examples/tiles/door_closed_top.png differ diff --git a/examples/tiles/door_open.png b/examples/tiles/door_open.png new file mode 100644 index 00000000..be39e5f0 Binary files /dev/null and b/examples/tiles/door_open.png differ diff --git a/examples/tiles/door_open_top.png b/examples/tiles/door_open_top.png new file mode 100644 index 00000000..df3c007b Binary files /dev/null and b/examples/tiles/door_open_top.png differ diff --git a/examples/tiles/fence.png b/examples/tiles/fence.png new file mode 100644 index 00000000..e683f8e6 Binary files /dev/null and b/examples/tiles/fence.png differ diff --git a/examples/tiles/fence_broken.png b/examples/tiles/fence_broken.png new file mode 100644 index 00000000..bfa66c2b Binary files /dev/null and b/examples/tiles/fence_broken.png differ diff --git a/examples/tiles/fireball.png b/examples/tiles/fireball.png new file mode 100644 index 00000000..d19053a7 Binary files /dev/null and b/examples/tiles/fireball.png differ diff --git a/examples/tiles/flag_blue_a.png b/examples/tiles/flag_blue_a.png new file mode 100644 index 00000000..c1c564f1 Binary files /dev/null and b/examples/tiles/flag_blue_a.png differ diff --git a/examples/tiles/flag_blue_b.png b/examples/tiles/flag_blue_b.png new file mode 100644 index 00000000..fe35e6b9 Binary files /dev/null and b/examples/tiles/flag_blue_b.png differ diff --git a/examples/tiles/flag_green_a.png b/examples/tiles/flag_green_a.png new file mode 100644 index 00000000..25ca9b46 Binary files /dev/null and b/examples/tiles/flag_green_a.png differ diff --git a/examples/tiles/flag_green_b.png b/examples/tiles/flag_green_b.png new file mode 100644 index 00000000..84300972 Binary files /dev/null and b/examples/tiles/flag_green_b.png differ diff --git a/examples/tiles/flag_off.png b/examples/tiles/flag_off.png new file mode 100644 index 00000000..d077251d Binary files /dev/null and b/examples/tiles/flag_off.png differ diff --git a/examples/tiles/flag_red_a.png b/examples/tiles/flag_red_a.png new file mode 100644 index 00000000..679196b2 Binary files /dev/null and b/examples/tiles/flag_red_a.png differ diff --git a/examples/tiles/flag_red_b.png b/examples/tiles/flag_red_b.png new file mode 100644 index 00000000..6c16eb20 Binary files /dev/null and b/examples/tiles/flag_red_b.png differ diff --git a/examples/tiles/flag_yellow_a.png b/examples/tiles/flag_yellow_a.png new file mode 100644 index 00000000..82a3bc97 Binary files /dev/null and b/examples/tiles/flag_yellow_a.png differ diff --git a/examples/tiles/flag_yellow_b.png b/examples/tiles/flag_yellow_b.png new file mode 100644 index 00000000..2806b519 Binary files /dev/null and b/examples/tiles/flag_yellow_b.png differ diff --git a/examples/tiles/gem_blue.png b/examples/tiles/gem_blue.png new file mode 100644 index 00000000..bfeeeea6 Binary files /dev/null and b/examples/tiles/gem_blue.png differ diff --git a/examples/tiles/gem_green.png b/examples/tiles/gem_green.png new file mode 100644 index 00000000..b0a23cde Binary files /dev/null and b/examples/tiles/gem_green.png differ diff --git a/examples/tiles/gem_red.png b/examples/tiles/gem_red.png new file mode 100644 index 00000000..0eab013a Binary files /dev/null and b/examples/tiles/gem_red.png differ diff --git a/examples/tiles/gem_yellow.png b/examples/tiles/gem_yellow.png new file mode 100644 index 00000000..b3ac749e Binary files /dev/null and b/examples/tiles/gem_yellow.png differ diff --git a/examples/tiles/grass.png b/examples/tiles/grass.png new file mode 100644 index 00000000..ed154cdb Binary files /dev/null and b/examples/tiles/grass.png differ diff --git a/examples/tiles/grass_purple.png b/examples/tiles/grass_purple.png new file mode 100644 index 00000000..aae18a94 Binary files /dev/null and b/examples/tiles/grass_purple.png differ diff --git a/examples/tiles/heart.png b/examples/tiles/heart.png new file mode 100644 index 00000000..9bd588c0 Binary files /dev/null and b/examples/tiles/heart.png differ diff --git a/examples/tiles/hill.png b/examples/tiles/hill.png new file mode 100644 index 00000000..357ffdbd Binary files /dev/null and b/examples/tiles/hill.png differ diff --git a/examples/tiles/hill_top.png b/examples/tiles/hill_top.png new file mode 100644 index 00000000..f3748da7 Binary files /dev/null and b/examples/tiles/hill_top.png differ diff --git a/examples/tiles/hill_top_smile.png b/examples/tiles/hill_top_smile.png new file mode 100644 index 00000000..6d778e21 Binary files /dev/null and b/examples/tiles/hill_top_smile.png differ diff --git a/examples/tiles/hud_character_0.png b/examples/tiles/hud_character_0.png new file mode 100644 index 00000000..c26a1f46 Binary files /dev/null and b/examples/tiles/hud_character_0.png differ diff --git a/examples/tiles/hud_character_1.png b/examples/tiles/hud_character_1.png new file mode 100644 index 00000000..9adceff1 Binary files /dev/null and b/examples/tiles/hud_character_1.png differ diff --git a/examples/tiles/hud_character_2.png b/examples/tiles/hud_character_2.png new file mode 100644 index 00000000..c5eb9844 Binary files /dev/null and b/examples/tiles/hud_character_2.png differ diff --git a/examples/tiles/hud_character_3.png b/examples/tiles/hud_character_3.png new file mode 100644 index 00000000..2b239e93 Binary files /dev/null and b/examples/tiles/hud_character_3.png differ diff --git a/examples/tiles/hud_character_4.png b/examples/tiles/hud_character_4.png new file mode 100644 index 00000000..106d1cc2 Binary files /dev/null and b/examples/tiles/hud_character_4.png differ diff --git a/examples/tiles/hud_character_5.png b/examples/tiles/hud_character_5.png new file mode 100644 index 00000000..c13d0a3b Binary files /dev/null and b/examples/tiles/hud_character_5.png differ diff --git a/examples/tiles/hud_character_6.png b/examples/tiles/hud_character_6.png new file mode 100644 index 00000000..a1858ef4 Binary files /dev/null and b/examples/tiles/hud_character_6.png differ diff --git a/examples/tiles/hud_character_7.png b/examples/tiles/hud_character_7.png new file mode 100644 index 00000000..3a725e37 Binary files /dev/null and b/examples/tiles/hud_character_7.png differ diff --git a/examples/tiles/hud_character_8.png b/examples/tiles/hud_character_8.png new file mode 100644 index 00000000..2ff2f50e Binary files /dev/null and b/examples/tiles/hud_character_8.png differ diff --git a/examples/tiles/hud_character_9.png b/examples/tiles/hud_character_9.png new file mode 100644 index 00000000..a894b137 Binary files /dev/null and b/examples/tiles/hud_character_9.png differ diff --git a/examples/tiles/hud_character_multiply.png b/examples/tiles/hud_character_multiply.png new file mode 100644 index 00000000..4bb8a9ba Binary files /dev/null and b/examples/tiles/hud_character_multiply.png differ diff --git a/examples/tiles/hud_character_percent.png b/examples/tiles/hud_character_percent.png new file mode 100644 index 00000000..4d52b4e3 Binary files /dev/null and b/examples/tiles/hud_character_percent.png differ diff --git a/examples/tiles/hud_coin.png b/examples/tiles/hud_coin.png new file mode 100644 index 00000000..48fd8d21 Binary files /dev/null and b/examples/tiles/hud_coin.png differ diff --git a/examples/tiles/hud_heart.png b/examples/tiles/hud_heart.png new file mode 100644 index 00000000..0222d381 Binary files /dev/null and b/examples/tiles/hud_heart.png differ diff --git a/examples/tiles/hud_heart_empty.png b/examples/tiles/hud_heart_empty.png new file mode 100644 index 00000000..8f700afe Binary files /dev/null and b/examples/tiles/hud_heart_empty.png differ diff --git a/examples/tiles/hud_heart_half.png b/examples/tiles/hud_heart_half.png new file mode 100644 index 00000000..b3ed8f2c Binary files /dev/null and b/examples/tiles/hud_heart_half.png differ diff --git a/examples/tiles/hud_key_blue.png b/examples/tiles/hud_key_blue.png new file mode 100644 index 00000000..e05d4437 Binary files /dev/null and b/examples/tiles/hud_key_blue.png differ diff --git a/examples/tiles/hud_key_green.png b/examples/tiles/hud_key_green.png new file mode 100644 index 00000000..c73d9809 Binary files /dev/null and b/examples/tiles/hud_key_green.png differ diff --git a/examples/tiles/hud_key_red.png b/examples/tiles/hud_key_red.png new file mode 100644 index 00000000..333612f8 Binary files /dev/null and b/examples/tiles/hud_key_red.png differ diff --git a/examples/tiles/hud_key_yellow.png b/examples/tiles/hud_key_yellow.png new file mode 100644 index 00000000..e373f9b0 Binary files /dev/null and b/examples/tiles/hud_key_yellow.png differ diff --git a/examples/tiles/hud_player_beige.png b/examples/tiles/hud_player_beige.png new file mode 100644 index 00000000..1c280d4f Binary files /dev/null and b/examples/tiles/hud_player_beige.png differ diff --git a/examples/tiles/hud_player_green.png b/examples/tiles/hud_player_green.png new file mode 100644 index 00000000..17338f43 Binary files /dev/null and b/examples/tiles/hud_player_green.png differ diff --git a/examples/tiles/hud_player_helmet_beige.png b/examples/tiles/hud_player_helmet_beige.png new file mode 100644 index 00000000..c57a83cf Binary files /dev/null and b/examples/tiles/hud_player_helmet_beige.png differ diff --git a/examples/tiles/hud_player_helmet_green.png b/examples/tiles/hud_player_helmet_green.png new file mode 100644 index 00000000..74f76d62 Binary files /dev/null and b/examples/tiles/hud_player_helmet_green.png differ diff --git a/examples/tiles/hud_player_helmet_pink.png b/examples/tiles/hud_player_helmet_pink.png new file mode 100644 index 00000000..235b0c48 Binary files /dev/null and b/examples/tiles/hud_player_helmet_pink.png differ diff --git a/examples/tiles/hud_player_helmet_purple.png b/examples/tiles/hud_player_helmet_purple.png new file mode 100644 index 00000000..62d060e3 Binary files /dev/null and b/examples/tiles/hud_player_helmet_purple.png differ diff --git a/examples/tiles/hud_player_helmet_yellow.png b/examples/tiles/hud_player_helmet_yellow.png new file mode 100644 index 00000000..51ed4ec1 Binary files /dev/null and b/examples/tiles/hud_player_helmet_yellow.png differ diff --git a/examples/tiles/hud_player_pink.png b/examples/tiles/hud_player_pink.png new file mode 100644 index 00000000..6e412f0c Binary files /dev/null and b/examples/tiles/hud_player_pink.png differ diff --git a/examples/tiles/hud_player_purple.png b/examples/tiles/hud_player_purple.png new file mode 100644 index 00000000..eb901b21 Binary files /dev/null and b/examples/tiles/hud_player_purple.png differ diff --git a/examples/tiles/hud_player_yellow.png b/examples/tiles/hud_player_yellow.png new file mode 100644 index 00000000..9d202474 Binary files /dev/null and b/examples/tiles/hud_player_yellow.png differ diff --git a/examples/tiles/key_blue.png b/examples/tiles/key_blue.png new file mode 100644 index 00000000..b8c48471 Binary files /dev/null and b/examples/tiles/key_blue.png differ diff --git a/examples/tiles/key_green.png b/examples/tiles/key_green.png new file mode 100644 index 00000000..c3dd3fa3 Binary files /dev/null and b/examples/tiles/key_green.png differ diff --git a/examples/tiles/key_red.png b/examples/tiles/key_red.png new file mode 100644 index 00000000..be98a184 Binary files /dev/null and b/examples/tiles/key_red.png differ diff --git a/examples/tiles/key_yellow.png b/examples/tiles/key_yellow.png new file mode 100644 index 00000000..d71d8ef9 Binary files /dev/null and b/examples/tiles/key_yellow.png differ diff --git a/examples/tiles/ladder_bottom.png b/examples/tiles/ladder_bottom.png new file mode 100644 index 00000000..c30d3d26 Binary files /dev/null and b/examples/tiles/ladder_bottom.png differ diff --git a/examples/tiles/ladder_middle.png b/examples/tiles/ladder_middle.png new file mode 100644 index 00000000..990b7275 Binary files /dev/null and b/examples/tiles/ladder_middle.png differ diff --git a/examples/tiles/ladder_top.png b/examples/tiles/ladder_top.png new file mode 100644 index 00000000..4f0f57f6 Binary files /dev/null and b/examples/tiles/ladder_top.png differ diff --git a/examples/tiles/lava.png b/examples/tiles/lava.png new file mode 100644 index 00000000..8be111a7 Binary files /dev/null and b/examples/tiles/lava.png differ diff --git a/examples/tiles/lava_top.png b/examples/tiles/lava_top.png new file mode 100644 index 00000000..796d6f4a Binary files /dev/null and b/examples/tiles/lava_top.png differ diff --git a/examples/tiles/lava_top_low.png b/examples/tiles/lava_top_low.png new file mode 100644 index 00000000..231f2c12 Binary files /dev/null and b/examples/tiles/lava_top_low.png differ diff --git a/examples/tiles/lever.png b/examples/tiles/lever.png new file mode 100644 index 00000000..7e49ce1d Binary files /dev/null and b/examples/tiles/lever.png differ diff --git a/examples/tiles/lever_left.png b/examples/tiles/lever_left.png new file mode 100644 index 00000000..5d93bce7 Binary files /dev/null and b/examples/tiles/lever_left.png differ diff --git a/examples/tiles/lever_right.png b/examples/tiles/lever_right.png new file mode 100644 index 00000000..9de04dbc Binary files /dev/null and b/examples/tiles/lever_right.png differ diff --git a/examples/tiles/lock_blue.png b/examples/tiles/lock_blue.png new file mode 100644 index 00000000..638e45ff Binary files /dev/null and b/examples/tiles/lock_blue.png differ diff --git a/examples/tiles/lock_green.png b/examples/tiles/lock_green.png new file mode 100644 index 00000000..5a29dba9 Binary files /dev/null and b/examples/tiles/lock_green.png differ diff --git a/examples/tiles/lock_red.png b/examples/tiles/lock_red.png new file mode 100644 index 00000000..83f650aa Binary files /dev/null and b/examples/tiles/lock_red.png differ diff --git a/examples/tiles/lock_yellow.png b/examples/tiles/lock_yellow.png new file mode 100644 index 00000000..397c8009 Binary files /dev/null and b/examples/tiles/lock_yellow.png differ diff --git a/examples/tiles/mushroom_brown.png b/examples/tiles/mushroom_brown.png new file mode 100644 index 00000000..dd2eeb8c Binary files /dev/null and b/examples/tiles/mushroom_brown.png differ diff --git a/examples/tiles/mushroom_red.png b/examples/tiles/mushroom_red.png new file mode 100644 index 00000000..81b410a9 Binary files /dev/null and b/examples/tiles/mushroom_red.png differ diff --git a/examples/tiles/ramp.png b/examples/tiles/ramp.png new file mode 100644 index 00000000..af037737 Binary files /dev/null and b/examples/tiles/ramp.png differ diff --git a/examples/tiles/rock.png b/examples/tiles/rock.png new file mode 100644 index 00000000..455696cb Binary files /dev/null and b/examples/tiles/rock.png differ diff --git a/examples/tiles/rop_attached.png b/examples/tiles/rop_attached.png new file mode 100644 index 00000000..dfbc1e1c Binary files /dev/null and b/examples/tiles/rop_attached.png differ diff --git a/examples/tiles/rope.png b/examples/tiles/rope.png new file mode 100644 index 00000000..551a4371 Binary files /dev/null and b/examples/tiles/rope.png differ diff --git a/examples/tiles/saw.png b/examples/tiles/saw.png new file mode 100644 index 00000000..7c372a7f Binary files /dev/null and b/examples/tiles/saw.png differ diff --git a/examples/tiles/sign.png b/examples/tiles/sign.png new file mode 100644 index 00000000..c3352a84 Binary files /dev/null and b/examples/tiles/sign.png differ diff --git a/examples/tiles/sign_exit.png b/examples/tiles/sign_exit.png new file mode 100644 index 00000000..92ce9e36 Binary files /dev/null and b/examples/tiles/sign_exit.png differ diff --git a/examples/tiles/sign_left.png b/examples/tiles/sign_left.png new file mode 100644 index 00000000..5de18a7e Binary files /dev/null and b/examples/tiles/sign_left.png differ diff --git a/examples/tiles/sign_right.png b/examples/tiles/sign_right.png new file mode 100644 index 00000000..22b9cf02 Binary files /dev/null and b/examples/tiles/sign_right.png differ diff --git a/examples/tiles/snow.png b/examples/tiles/snow.png new file mode 100644 index 00000000..4a50492b Binary files /dev/null and b/examples/tiles/snow.png differ diff --git a/examples/tiles/spikes.png b/examples/tiles/spikes.png new file mode 100644 index 00000000..0c38f262 Binary files /dev/null and b/examples/tiles/spikes.png differ diff --git a/examples/tiles/spring.png b/examples/tiles/spring.png new file mode 100644 index 00000000..abe244b0 Binary files /dev/null and b/examples/tiles/spring.png differ diff --git a/examples/tiles/spring_out.png b/examples/tiles/spring_out.png new file mode 100644 index 00000000..e35f8d74 Binary files /dev/null and b/examples/tiles/spring_out.png differ diff --git a/examples/tiles/star.png b/examples/tiles/star.png new file mode 100644 index 00000000..efe4c6b1 Binary files /dev/null and b/examples/tiles/star.png differ diff --git a/examples/tiles/switch_blue.png b/examples/tiles/switch_blue.png new file mode 100644 index 00000000..312cfb4c Binary files /dev/null and b/examples/tiles/switch_blue.png differ diff --git a/examples/tiles/switch_blue_pressed.png b/examples/tiles/switch_blue_pressed.png new file mode 100644 index 00000000..2b7cde9a Binary files /dev/null and b/examples/tiles/switch_blue_pressed.png differ diff --git a/examples/tiles/switch_green.png b/examples/tiles/switch_green.png new file mode 100644 index 00000000..26147810 Binary files /dev/null and b/examples/tiles/switch_green.png differ diff --git a/examples/tiles/switch_green_pressed.png b/examples/tiles/switch_green_pressed.png new file mode 100644 index 00000000..7b13a5eb Binary files /dev/null and b/examples/tiles/switch_green_pressed.png differ diff --git a/examples/tiles/switch_red.png b/examples/tiles/switch_red.png new file mode 100644 index 00000000..d17c438d Binary files /dev/null and b/examples/tiles/switch_red.png differ diff --git a/examples/tiles/switch_red_pressed.png b/examples/tiles/switch_red_pressed.png new file mode 100644 index 00000000..160f6e92 Binary files /dev/null and b/examples/tiles/switch_red_pressed.png differ diff --git a/examples/tiles/switch_yellow.png b/examples/tiles/switch_yellow.png new file mode 100644 index 00000000..d4111598 Binary files /dev/null and b/examples/tiles/switch_yellow.png differ diff --git a/examples/tiles/switch_yellow_pressed.png b/examples/tiles/switch_yellow_pressed.png new file mode 100644 index 00000000..130e4908 Binary files /dev/null and b/examples/tiles/switch_yellow_pressed.png differ diff --git a/examples/tiles/terrain_dirt_block.png b/examples/tiles/terrain_dirt_block.png new file mode 100644 index 00000000..e89ceaf8 Binary files /dev/null and b/examples/tiles/terrain_dirt_block.png differ diff --git a/examples/tiles/terrain_dirt_block_bottom.png b/examples/tiles/terrain_dirt_block_bottom.png new file mode 100644 index 00000000..17c480c7 Binary files /dev/null and b/examples/tiles/terrain_dirt_block_bottom.png differ diff --git a/examples/tiles/terrain_dirt_block_bottom_left.png b/examples/tiles/terrain_dirt_block_bottom_left.png new file mode 100644 index 00000000..2d2ab997 Binary files /dev/null and b/examples/tiles/terrain_dirt_block_bottom_left.png differ diff --git a/examples/tiles/terrain_dirt_block_bottom_right.png b/examples/tiles/terrain_dirt_block_bottom_right.png new file mode 100644 index 00000000..83f3c05a Binary files /dev/null and b/examples/tiles/terrain_dirt_block_bottom_right.png differ diff --git a/examples/tiles/terrain_dirt_block_center.png b/examples/tiles/terrain_dirt_block_center.png new file mode 100644 index 00000000..4bf054ec Binary files /dev/null and b/examples/tiles/terrain_dirt_block_center.png differ diff --git a/examples/tiles/terrain_dirt_block_left.png b/examples/tiles/terrain_dirt_block_left.png new file mode 100644 index 00000000..f95f4fb6 Binary files /dev/null and b/examples/tiles/terrain_dirt_block_left.png differ diff --git a/examples/tiles/terrain_dirt_block_right.png b/examples/tiles/terrain_dirt_block_right.png new file mode 100644 index 00000000..1374f727 Binary files /dev/null and b/examples/tiles/terrain_dirt_block_right.png differ diff --git a/examples/tiles/terrain_dirt_block_top.png b/examples/tiles/terrain_dirt_block_top.png new file mode 100644 index 00000000..9dec216f Binary files /dev/null and b/examples/tiles/terrain_dirt_block_top.png differ diff --git a/examples/tiles/terrain_dirt_block_top_left.png b/examples/tiles/terrain_dirt_block_top_left.png new file mode 100644 index 00000000..dda4cff2 Binary files /dev/null and b/examples/tiles/terrain_dirt_block_top_left.png differ diff --git a/examples/tiles/terrain_dirt_block_top_right.png b/examples/tiles/terrain_dirt_block_top_right.png new file mode 100644 index 00000000..87583510 Binary files /dev/null and b/examples/tiles/terrain_dirt_block_top_right.png differ diff --git a/examples/tiles/terrain_dirt_cloud.png b/examples/tiles/terrain_dirt_cloud.png new file mode 100644 index 00000000..a668ae1a Binary files /dev/null and b/examples/tiles/terrain_dirt_cloud.png differ diff --git a/examples/tiles/terrain_dirt_cloud_background.png b/examples/tiles/terrain_dirt_cloud_background.png new file mode 100644 index 00000000..d71b04eb Binary files /dev/null and b/examples/tiles/terrain_dirt_cloud_background.png differ diff --git a/examples/tiles/terrain_dirt_cloud_left.png b/examples/tiles/terrain_dirt_cloud_left.png new file mode 100644 index 00000000..6e4f6b10 Binary files /dev/null and b/examples/tiles/terrain_dirt_cloud_left.png differ diff --git a/examples/tiles/terrain_dirt_cloud_middle.png b/examples/tiles/terrain_dirt_cloud_middle.png new file mode 100644 index 00000000..5a4b9e88 Binary files /dev/null and b/examples/tiles/terrain_dirt_cloud_middle.png differ diff --git a/examples/tiles/terrain_dirt_cloud_right.png b/examples/tiles/terrain_dirt_cloud_right.png new file mode 100644 index 00000000..0ff4fe2e Binary files /dev/null and b/examples/tiles/terrain_dirt_cloud_right.png differ diff --git a/examples/tiles/terrain_dirt_horizontal_left.png b/examples/tiles/terrain_dirt_horizontal_left.png new file mode 100644 index 00000000..4d6d8280 Binary files /dev/null and b/examples/tiles/terrain_dirt_horizontal_left.png differ diff --git a/examples/tiles/terrain_dirt_horizontal_middle.png b/examples/tiles/terrain_dirt_horizontal_middle.png new file mode 100644 index 00000000..41b4d359 Binary files /dev/null and b/examples/tiles/terrain_dirt_horizontal_middle.png differ diff --git a/examples/tiles/terrain_dirt_horizontal_overhang_left.png b/examples/tiles/terrain_dirt_horizontal_overhang_left.png new file mode 100644 index 00000000..eca24848 Binary files /dev/null and b/examples/tiles/terrain_dirt_horizontal_overhang_left.png differ diff --git a/examples/tiles/terrain_dirt_horizontal_overhang_right.png b/examples/tiles/terrain_dirt_horizontal_overhang_right.png new file mode 100644 index 00000000..f48fbfd0 Binary files /dev/null and b/examples/tiles/terrain_dirt_horizontal_overhang_right.png differ diff --git a/examples/tiles/terrain_dirt_horizontal_right.png b/examples/tiles/terrain_dirt_horizontal_right.png new file mode 100644 index 00000000..708c0cb3 Binary files /dev/null and b/examples/tiles/terrain_dirt_horizontal_right.png differ diff --git a/examples/tiles/terrain_dirt_ramp_long_a.png b/examples/tiles/terrain_dirt_ramp_long_a.png new file mode 100644 index 00000000..2a609b20 Binary files /dev/null and b/examples/tiles/terrain_dirt_ramp_long_a.png differ diff --git a/examples/tiles/terrain_dirt_ramp_long_b.png b/examples/tiles/terrain_dirt_ramp_long_b.png new file mode 100644 index 00000000..e7287d2a Binary files /dev/null and b/examples/tiles/terrain_dirt_ramp_long_b.png differ diff --git a/examples/tiles/terrain_dirt_ramp_long_c.png b/examples/tiles/terrain_dirt_ramp_long_c.png new file mode 100644 index 00000000..8cf93d55 Binary files /dev/null and b/examples/tiles/terrain_dirt_ramp_long_c.png differ diff --git a/examples/tiles/terrain_dirt_ramp_short_a.png b/examples/tiles/terrain_dirt_ramp_short_a.png new file mode 100644 index 00000000..06f49227 Binary files /dev/null and b/examples/tiles/terrain_dirt_ramp_short_a.png differ diff --git a/examples/tiles/terrain_dirt_ramp_short_b.png b/examples/tiles/terrain_dirt_ramp_short_b.png new file mode 100644 index 00000000..67abbf1b Binary files /dev/null and b/examples/tiles/terrain_dirt_ramp_short_b.png differ diff --git a/examples/tiles/terrain_dirt_vertical_bottom.png b/examples/tiles/terrain_dirt_vertical_bottom.png new file mode 100644 index 00000000..e8df342c Binary files /dev/null and b/examples/tiles/terrain_dirt_vertical_bottom.png differ diff --git a/examples/tiles/terrain_dirt_vertical_middle.png b/examples/tiles/terrain_dirt_vertical_middle.png new file mode 100644 index 00000000..3f140373 Binary files /dev/null and b/examples/tiles/terrain_dirt_vertical_middle.png differ diff --git a/examples/tiles/terrain_dirt_vertical_top.png b/examples/tiles/terrain_dirt_vertical_top.png new file mode 100644 index 00000000..81e00e3e Binary files /dev/null and b/examples/tiles/terrain_dirt_vertical_top.png differ diff --git a/examples/tiles/terrain_grass_block.png b/examples/tiles/terrain_grass_block.png new file mode 100644 index 00000000..4ac368e4 Binary files /dev/null and b/examples/tiles/terrain_grass_block.png differ diff --git a/examples/tiles/terrain_grass_block_bottom.png b/examples/tiles/terrain_grass_block_bottom.png new file mode 100644 index 00000000..11d17f73 Binary files /dev/null and b/examples/tiles/terrain_grass_block_bottom.png differ diff --git a/examples/tiles/terrain_grass_block_bottom_left.png b/examples/tiles/terrain_grass_block_bottom_left.png new file mode 100644 index 00000000..26d75270 Binary files /dev/null and b/examples/tiles/terrain_grass_block_bottom_left.png differ diff --git a/examples/tiles/terrain_grass_block_bottom_right.png b/examples/tiles/terrain_grass_block_bottom_right.png new file mode 100644 index 00000000..5ac9b60a Binary files /dev/null and b/examples/tiles/terrain_grass_block_bottom_right.png differ diff --git a/examples/tiles/terrain_grass_block_center.png b/examples/tiles/terrain_grass_block_center.png new file mode 100644 index 00000000..a8e6d04a Binary files /dev/null and b/examples/tiles/terrain_grass_block_center.png differ diff --git a/examples/tiles/terrain_grass_block_left.png b/examples/tiles/terrain_grass_block_left.png new file mode 100644 index 00000000..7811ca17 Binary files /dev/null and b/examples/tiles/terrain_grass_block_left.png differ diff --git a/examples/tiles/terrain_grass_block_right.png b/examples/tiles/terrain_grass_block_right.png new file mode 100644 index 00000000..53688e17 Binary files /dev/null and b/examples/tiles/terrain_grass_block_right.png differ diff --git a/examples/tiles/terrain_grass_block_top.png b/examples/tiles/terrain_grass_block_top.png new file mode 100644 index 00000000..8e1cb355 Binary files /dev/null and b/examples/tiles/terrain_grass_block_top.png differ diff --git a/examples/tiles/terrain_grass_block_top_left.png b/examples/tiles/terrain_grass_block_top_left.png new file mode 100644 index 00000000..ece74461 Binary files /dev/null and b/examples/tiles/terrain_grass_block_top_left.png differ diff --git a/examples/tiles/terrain_grass_block_top_right.png b/examples/tiles/terrain_grass_block_top_right.png new file mode 100644 index 00000000..45e9dd89 Binary files /dev/null and b/examples/tiles/terrain_grass_block_top_right.png differ diff --git a/examples/tiles/terrain_grass_cloud.png b/examples/tiles/terrain_grass_cloud.png new file mode 100644 index 00000000..b9c8623b Binary files /dev/null and b/examples/tiles/terrain_grass_cloud.png differ diff --git a/examples/tiles/terrain_grass_cloud_background.png b/examples/tiles/terrain_grass_cloud_background.png new file mode 100644 index 00000000..ab356041 Binary files /dev/null and b/examples/tiles/terrain_grass_cloud_background.png differ diff --git a/examples/tiles/terrain_grass_cloud_left.png b/examples/tiles/terrain_grass_cloud_left.png new file mode 100644 index 00000000..232cb13e Binary files /dev/null and b/examples/tiles/terrain_grass_cloud_left.png differ diff --git a/examples/tiles/terrain_grass_cloud_middle.png b/examples/tiles/terrain_grass_cloud_middle.png new file mode 100644 index 00000000..d5f6ffb9 Binary files /dev/null and b/examples/tiles/terrain_grass_cloud_middle.png differ diff --git a/examples/tiles/terrain_grass_cloud_right.png b/examples/tiles/terrain_grass_cloud_right.png new file mode 100644 index 00000000..7a627c05 Binary files /dev/null and b/examples/tiles/terrain_grass_cloud_right.png differ diff --git a/examples/tiles/terrain_grass_horizontal_left.png b/examples/tiles/terrain_grass_horizontal_left.png new file mode 100644 index 00000000..9775474c Binary files /dev/null and b/examples/tiles/terrain_grass_horizontal_left.png differ diff --git a/examples/tiles/terrain_grass_horizontal_middle.png b/examples/tiles/terrain_grass_horizontal_middle.png new file mode 100644 index 00000000..53e5351a Binary files /dev/null and b/examples/tiles/terrain_grass_horizontal_middle.png differ diff --git a/examples/tiles/terrain_grass_horizontal_overhang_left.png b/examples/tiles/terrain_grass_horizontal_overhang_left.png new file mode 100644 index 00000000..8f5a7035 Binary files /dev/null and b/examples/tiles/terrain_grass_horizontal_overhang_left.png differ diff --git a/examples/tiles/terrain_grass_horizontal_overhang_right.png b/examples/tiles/terrain_grass_horizontal_overhang_right.png new file mode 100644 index 00000000..09e2b409 Binary files /dev/null and b/examples/tiles/terrain_grass_horizontal_overhang_right.png differ diff --git a/examples/tiles/terrain_grass_horizontal_right.png b/examples/tiles/terrain_grass_horizontal_right.png new file mode 100644 index 00000000..ec4dc3e7 Binary files /dev/null and b/examples/tiles/terrain_grass_horizontal_right.png differ diff --git a/examples/tiles/terrain_grass_ramp_long_a.png b/examples/tiles/terrain_grass_ramp_long_a.png new file mode 100644 index 00000000..644d418b Binary files /dev/null and b/examples/tiles/terrain_grass_ramp_long_a.png differ diff --git a/examples/tiles/terrain_grass_ramp_long_b.png b/examples/tiles/terrain_grass_ramp_long_b.png new file mode 100644 index 00000000..44fd2796 Binary files /dev/null and b/examples/tiles/terrain_grass_ramp_long_b.png differ diff --git a/examples/tiles/terrain_grass_ramp_long_c.png b/examples/tiles/terrain_grass_ramp_long_c.png new file mode 100644 index 00000000..c7fa26f9 Binary files /dev/null and b/examples/tiles/terrain_grass_ramp_long_c.png differ diff --git a/examples/tiles/terrain_grass_ramp_short_a.png b/examples/tiles/terrain_grass_ramp_short_a.png new file mode 100644 index 00000000..cdebe4b5 Binary files /dev/null and b/examples/tiles/terrain_grass_ramp_short_a.png differ diff --git a/examples/tiles/terrain_grass_ramp_short_b.png b/examples/tiles/terrain_grass_ramp_short_b.png new file mode 100644 index 00000000..2dffd54d Binary files /dev/null and b/examples/tiles/terrain_grass_ramp_short_b.png differ diff --git a/examples/tiles/terrain_grass_vertical_bottom.png b/examples/tiles/terrain_grass_vertical_bottom.png new file mode 100644 index 00000000..bb2b7350 Binary files /dev/null and b/examples/tiles/terrain_grass_vertical_bottom.png differ diff --git a/examples/tiles/terrain_grass_vertical_middle.png b/examples/tiles/terrain_grass_vertical_middle.png new file mode 100644 index 00000000..ea3c52c4 Binary files /dev/null and b/examples/tiles/terrain_grass_vertical_middle.png differ diff --git a/examples/tiles/terrain_grass_vertical_top.png b/examples/tiles/terrain_grass_vertical_top.png new file mode 100644 index 00000000..d3ce43f6 Binary files /dev/null and b/examples/tiles/terrain_grass_vertical_top.png differ diff --git a/examples/tiles/terrain_purple_block.png b/examples/tiles/terrain_purple_block.png new file mode 100644 index 00000000..9ebbe56e Binary files /dev/null and b/examples/tiles/terrain_purple_block.png differ diff --git a/examples/tiles/terrain_purple_block_bottom.png b/examples/tiles/terrain_purple_block_bottom.png new file mode 100644 index 00000000..6df1698a Binary files /dev/null and b/examples/tiles/terrain_purple_block_bottom.png differ diff --git a/examples/tiles/terrain_purple_block_bottom_left.png b/examples/tiles/terrain_purple_block_bottom_left.png new file mode 100644 index 00000000..9b4f498a Binary files /dev/null and b/examples/tiles/terrain_purple_block_bottom_left.png differ diff --git a/examples/tiles/terrain_purple_block_bottom_right.png b/examples/tiles/terrain_purple_block_bottom_right.png new file mode 100644 index 00000000..47afe9d3 Binary files /dev/null and b/examples/tiles/terrain_purple_block_bottom_right.png differ diff --git a/examples/tiles/terrain_purple_block_center.png b/examples/tiles/terrain_purple_block_center.png new file mode 100644 index 00000000..0c046ebe Binary files /dev/null and b/examples/tiles/terrain_purple_block_center.png differ diff --git a/examples/tiles/terrain_purple_block_left.png b/examples/tiles/terrain_purple_block_left.png new file mode 100644 index 00000000..e914acc6 Binary files /dev/null and b/examples/tiles/terrain_purple_block_left.png differ diff --git a/examples/tiles/terrain_purple_block_right.png b/examples/tiles/terrain_purple_block_right.png new file mode 100644 index 00000000..83463140 Binary files /dev/null and b/examples/tiles/terrain_purple_block_right.png differ diff --git a/examples/tiles/terrain_purple_block_top.png b/examples/tiles/terrain_purple_block_top.png new file mode 100644 index 00000000..02a1385b Binary files /dev/null and b/examples/tiles/terrain_purple_block_top.png differ diff --git a/examples/tiles/terrain_purple_block_top_left.png b/examples/tiles/terrain_purple_block_top_left.png new file mode 100644 index 00000000..51c18006 Binary files /dev/null and b/examples/tiles/terrain_purple_block_top_left.png differ diff --git a/examples/tiles/terrain_purple_block_top_right.png b/examples/tiles/terrain_purple_block_top_right.png new file mode 100644 index 00000000..66b5671a Binary files /dev/null and b/examples/tiles/terrain_purple_block_top_right.png differ diff --git a/examples/tiles/terrain_purple_cloud.png b/examples/tiles/terrain_purple_cloud.png new file mode 100644 index 00000000..8b952edb Binary files /dev/null and b/examples/tiles/terrain_purple_cloud.png differ diff --git a/examples/tiles/terrain_purple_cloud_background.png b/examples/tiles/terrain_purple_cloud_background.png new file mode 100644 index 00000000..53794aef Binary files /dev/null and b/examples/tiles/terrain_purple_cloud_background.png differ diff --git a/examples/tiles/terrain_purple_cloud_left.png b/examples/tiles/terrain_purple_cloud_left.png new file mode 100644 index 00000000..816baea4 Binary files /dev/null and b/examples/tiles/terrain_purple_cloud_left.png differ diff --git a/examples/tiles/terrain_purple_cloud_middle.png b/examples/tiles/terrain_purple_cloud_middle.png new file mode 100644 index 00000000..e52c268e Binary files /dev/null and b/examples/tiles/terrain_purple_cloud_middle.png differ diff --git a/examples/tiles/terrain_purple_cloud_right.png b/examples/tiles/terrain_purple_cloud_right.png new file mode 100644 index 00000000..2cd09c3a Binary files /dev/null and b/examples/tiles/terrain_purple_cloud_right.png differ diff --git a/examples/tiles/terrain_purple_horizontal_left.png b/examples/tiles/terrain_purple_horizontal_left.png new file mode 100644 index 00000000..16aefa13 Binary files /dev/null and b/examples/tiles/terrain_purple_horizontal_left.png differ diff --git a/examples/tiles/terrain_purple_horizontal_middle.png b/examples/tiles/terrain_purple_horizontal_middle.png new file mode 100644 index 00000000..6e48eee3 Binary files /dev/null and b/examples/tiles/terrain_purple_horizontal_middle.png differ diff --git a/examples/tiles/terrain_purple_horizontal_overhang_left.png b/examples/tiles/terrain_purple_horizontal_overhang_left.png new file mode 100644 index 00000000..85d78b36 Binary files /dev/null and b/examples/tiles/terrain_purple_horizontal_overhang_left.png differ diff --git a/examples/tiles/terrain_purple_horizontal_overhang_right.png b/examples/tiles/terrain_purple_horizontal_overhang_right.png new file mode 100644 index 00000000..eb6484d5 Binary files /dev/null and b/examples/tiles/terrain_purple_horizontal_overhang_right.png differ diff --git a/examples/tiles/terrain_purple_horizontal_right.png b/examples/tiles/terrain_purple_horizontal_right.png new file mode 100644 index 00000000..d3b45d5f Binary files /dev/null and b/examples/tiles/terrain_purple_horizontal_right.png differ diff --git a/examples/tiles/terrain_purple_ramp_long_a.png b/examples/tiles/terrain_purple_ramp_long_a.png new file mode 100644 index 00000000..b382301b Binary files /dev/null and b/examples/tiles/terrain_purple_ramp_long_a.png differ diff --git a/examples/tiles/terrain_purple_ramp_long_b.png b/examples/tiles/terrain_purple_ramp_long_b.png new file mode 100644 index 00000000..3eac2c0d Binary files /dev/null and b/examples/tiles/terrain_purple_ramp_long_b.png differ diff --git a/examples/tiles/terrain_purple_ramp_long_c.png b/examples/tiles/terrain_purple_ramp_long_c.png new file mode 100644 index 00000000..757050cf Binary files /dev/null and b/examples/tiles/terrain_purple_ramp_long_c.png differ diff --git a/examples/tiles/terrain_purple_ramp_short_a.png b/examples/tiles/terrain_purple_ramp_short_a.png new file mode 100644 index 00000000..f6f97ec6 Binary files /dev/null and b/examples/tiles/terrain_purple_ramp_short_a.png differ diff --git a/examples/tiles/terrain_purple_ramp_short_b.png b/examples/tiles/terrain_purple_ramp_short_b.png new file mode 100644 index 00000000..8e9f15ef Binary files /dev/null and b/examples/tiles/terrain_purple_ramp_short_b.png differ diff --git a/examples/tiles/terrain_purple_vertical_bottom.png b/examples/tiles/terrain_purple_vertical_bottom.png new file mode 100644 index 00000000..633db740 Binary files /dev/null and b/examples/tiles/terrain_purple_vertical_bottom.png differ diff --git a/examples/tiles/terrain_purple_vertical_middle.png b/examples/tiles/terrain_purple_vertical_middle.png new file mode 100644 index 00000000..e927ee63 Binary files /dev/null and b/examples/tiles/terrain_purple_vertical_middle.png differ diff --git a/examples/tiles/terrain_purple_vertical_top.png b/examples/tiles/terrain_purple_vertical_top.png new file mode 100644 index 00000000..ae4133ce Binary files /dev/null and b/examples/tiles/terrain_purple_vertical_top.png differ diff --git a/examples/tiles/terrain_sand_block.png b/examples/tiles/terrain_sand_block.png new file mode 100644 index 00000000..7abba388 Binary files /dev/null and b/examples/tiles/terrain_sand_block.png differ diff --git a/examples/tiles/terrain_sand_block_bottom.png b/examples/tiles/terrain_sand_block_bottom.png new file mode 100644 index 00000000..0a73fa86 Binary files /dev/null and b/examples/tiles/terrain_sand_block_bottom.png differ diff --git a/examples/tiles/terrain_sand_block_bottom_left.png b/examples/tiles/terrain_sand_block_bottom_left.png new file mode 100644 index 00000000..7b92c5c7 Binary files /dev/null and b/examples/tiles/terrain_sand_block_bottom_left.png differ diff --git a/examples/tiles/terrain_sand_block_bottom_right.png b/examples/tiles/terrain_sand_block_bottom_right.png new file mode 100644 index 00000000..6eab6028 Binary files /dev/null and b/examples/tiles/terrain_sand_block_bottom_right.png differ diff --git a/examples/tiles/terrain_sand_block_center.png b/examples/tiles/terrain_sand_block_center.png new file mode 100644 index 00000000..49d97f3b Binary files /dev/null and b/examples/tiles/terrain_sand_block_center.png differ diff --git a/examples/tiles/terrain_sand_block_left.png b/examples/tiles/terrain_sand_block_left.png new file mode 100644 index 00000000..a423c3fa Binary files /dev/null and b/examples/tiles/terrain_sand_block_left.png differ diff --git a/examples/tiles/terrain_sand_block_right.png b/examples/tiles/terrain_sand_block_right.png new file mode 100644 index 00000000..d793e0f7 Binary files /dev/null and b/examples/tiles/terrain_sand_block_right.png differ diff --git a/examples/tiles/terrain_sand_block_top.png b/examples/tiles/terrain_sand_block_top.png new file mode 100644 index 00000000..2b684999 Binary files /dev/null and b/examples/tiles/terrain_sand_block_top.png differ diff --git a/examples/tiles/terrain_sand_block_top_left.png b/examples/tiles/terrain_sand_block_top_left.png new file mode 100644 index 00000000..c86ee8f2 Binary files /dev/null and b/examples/tiles/terrain_sand_block_top_left.png differ diff --git a/examples/tiles/terrain_sand_block_top_right.png b/examples/tiles/terrain_sand_block_top_right.png new file mode 100644 index 00000000..37c7ab5c Binary files /dev/null and b/examples/tiles/terrain_sand_block_top_right.png differ diff --git a/examples/tiles/terrain_sand_cloud.png b/examples/tiles/terrain_sand_cloud.png new file mode 100644 index 00000000..54b38885 Binary files /dev/null and b/examples/tiles/terrain_sand_cloud.png differ diff --git a/examples/tiles/terrain_sand_cloud_background.png b/examples/tiles/terrain_sand_cloud_background.png new file mode 100644 index 00000000..de91e09c Binary files /dev/null and b/examples/tiles/terrain_sand_cloud_background.png differ diff --git a/examples/tiles/terrain_sand_cloud_left.png b/examples/tiles/terrain_sand_cloud_left.png new file mode 100644 index 00000000..c4afa11e Binary files /dev/null and b/examples/tiles/terrain_sand_cloud_left.png differ diff --git a/examples/tiles/terrain_sand_cloud_middle.png b/examples/tiles/terrain_sand_cloud_middle.png new file mode 100644 index 00000000..e3e4186a Binary files /dev/null and b/examples/tiles/terrain_sand_cloud_middle.png differ diff --git a/examples/tiles/terrain_sand_cloud_right.png b/examples/tiles/terrain_sand_cloud_right.png new file mode 100644 index 00000000..78fa9868 Binary files /dev/null and b/examples/tiles/terrain_sand_cloud_right.png differ diff --git a/examples/tiles/terrain_sand_horizontal_left.png b/examples/tiles/terrain_sand_horizontal_left.png new file mode 100644 index 00000000..7daba42f Binary files /dev/null and b/examples/tiles/terrain_sand_horizontal_left.png differ diff --git a/examples/tiles/terrain_sand_horizontal_middle.png b/examples/tiles/terrain_sand_horizontal_middle.png new file mode 100644 index 00000000..b83d0f1a Binary files /dev/null and b/examples/tiles/terrain_sand_horizontal_middle.png differ diff --git a/examples/tiles/terrain_sand_horizontal_overhang_left.png b/examples/tiles/terrain_sand_horizontal_overhang_left.png new file mode 100644 index 00000000..5a1f2acf Binary files /dev/null and b/examples/tiles/terrain_sand_horizontal_overhang_left.png differ diff --git a/examples/tiles/terrain_sand_horizontal_overhang_right.png b/examples/tiles/terrain_sand_horizontal_overhang_right.png new file mode 100644 index 00000000..def0e2f1 Binary files /dev/null and b/examples/tiles/terrain_sand_horizontal_overhang_right.png differ diff --git a/examples/tiles/terrain_sand_horizontal_right.png b/examples/tiles/terrain_sand_horizontal_right.png new file mode 100644 index 00000000..76456899 Binary files /dev/null and b/examples/tiles/terrain_sand_horizontal_right.png differ diff --git a/examples/tiles/terrain_sand_ramp_long_a.png b/examples/tiles/terrain_sand_ramp_long_a.png new file mode 100644 index 00000000..3e932e3a Binary files /dev/null and b/examples/tiles/terrain_sand_ramp_long_a.png differ diff --git a/examples/tiles/terrain_sand_ramp_long_b.png b/examples/tiles/terrain_sand_ramp_long_b.png new file mode 100644 index 00000000..ca4ee581 Binary files /dev/null and b/examples/tiles/terrain_sand_ramp_long_b.png differ diff --git a/examples/tiles/terrain_sand_ramp_long_c.png b/examples/tiles/terrain_sand_ramp_long_c.png new file mode 100644 index 00000000..77c1d258 Binary files /dev/null and b/examples/tiles/terrain_sand_ramp_long_c.png differ diff --git a/examples/tiles/terrain_sand_ramp_short_a.png b/examples/tiles/terrain_sand_ramp_short_a.png new file mode 100644 index 00000000..f32f3a1a Binary files /dev/null and b/examples/tiles/terrain_sand_ramp_short_a.png differ diff --git a/examples/tiles/terrain_sand_ramp_short_b.png b/examples/tiles/terrain_sand_ramp_short_b.png new file mode 100644 index 00000000..2298635b Binary files /dev/null and b/examples/tiles/terrain_sand_ramp_short_b.png differ diff --git a/examples/tiles/terrain_sand_vertical_bottom.png b/examples/tiles/terrain_sand_vertical_bottom.png new file mode 100644 index 00000000..c3f8ba04 Binary files /dev/null and b/examples/tiles/terrain_sand_vertical_bottom.png differ diff --git a/examples/tiles/terrain_sand_vertical_middle.png b/examples/tiles/terrain_sand_vertical_middle.png new file mode 100644 index 00000000..78195229 Binary files /dev/null and b/examples/tiles/terrain_sand_vertical_middle.png differ diff --git a/examples/tiles/terrain_sand_vertical_top.png b/examples/tiles/terrain_sand_vertical_top.png new file mode 100644 index 00000000..e4bbbc89 Binary files /dev/null and b/examples/tiles/terrain_sand_vertical_top.png differ diff --git a/examples/tiles/terrain_snow_block.png b/examples/tiles/terrain_snow_block.png new file mode 100644 index 00000000..aa97486f Binary files /dev/null and b/examples/tiles/terrain_snow_block.png differ diff --git a/examples/tiles/terrain_snow_block_bottom.png b/examples/tiles/terrain_snow_block_bottom.png new file mode 100644 index 00000000..f0f8d852 Binary files /dev/null and b/examples/tiles/terrain_snow_block_bottom.png differ diff --git a/examples/tiles/terrain_snow_block_bottom_left.png b/examples/tiles/terrain_snow_block_bottom_left.png new file mode 100644 index 00000000..f8b62dae Binary files /dev/null and b/examples/tiles/terrain_snow_block_bottom_left.png differ diff --git a/examples/tiles/terrain_snow_block_bottom_right.png b/examples/tiles/terrain_snow_block_bottom_right.png new file mode 100644 index 00000000..a6ca0f96 Binary files /dev/null and b/examples/tiles/terrain_snow_block_bottom_right.png differ diff --git a/examples/tiles/terrain_snow_block_center.png b/examples/tiles/terrain_snow_block_center.png new file mode 100644 index 00000000..25464ece Binary files /dev/null and b/examples/tiles/terrain_snow_block_center.png differ diff --git a/examples/tiles/terrain_snow_block_left.png b/examples/tiles/terrain_snow_block_left.png new file mode 100644 index 00000000..1e28b5b5 Binary files /dev/null and b/examples/tiles/terrain_snow_block_left.png differ diff --git a/examples/tiles/terrain_snow_block_right.png b/examples/tiles/terrain_snow_block_right.png new file mode 100644 index 00000000..00c879c6 Binary files /dev/null and b/examples/tiles/terrain_snow_block_right.png differ diff --git a/examples/tiles/terrain_snow_block_top.png b/examples/tiles/terrain_snow_block_top.png new file mode 100644 index 00000000..84366546 Binary files /dev/null and b/examples/tiles/terrain_snow_block_top.png differ diff --git a/examples/tiles/terrain_snow_block_top_left.png b/examples/tiles/terrain_snow_block_top_left.png new file mode 100644 index 00000000..a901b289 Binary files /dev/null and b/examples/tiles/terrain_snow_block_top_left.png differ diff --git a/examples/tiles/terrain_snow_block_top_right.png b/examples/tiles/terrain_snow_block_top_right.png new file mode 100644 index 00000000..caa02c44 Binary files /dev/null and b/examples/tiles/terrain_snow_block_top_right.png differ diff --git a/examples/tiles/terrain_snow_cloud.png b/examples/tiles/terrain_snow_cloud.png new file mode 100644 index 00000000..363db044 Binary files /dev/null and b/examples/tiles/terrain_snow_cloud.png differ diff --git a/examples/tiles/terrain_snow_cloud_background.png b/examples/tiles/terrain_snow_cloud_background.png new file mode 100644 index 00000000..54c331e8 Binary files /dev/null and b/examples/tiles/terrain_snow_cloud_background.png differ diff --git a/examples/tiles/terrain_snow_cloud_left.png b/examples/tiles/terrain_snow_cloud_left.png new file mode 100644 index 00000000..666f818a Binary files /dev/null and b/examples/tiles/terrain_snow_cloud_left.png differ diff --git a/examples/tiles/terrain_snow_cloud_middle.png b/examples/tiles/terrain_snow_cloud_middle.png new file mode 100644 index 00000000..eda3c1fa Binary files /dev/null and b/examples/tiles/terrain_snow_cloud_middle.png differ diff --git a/examples/tiles/terrain_snow_cloud_right.png b/examples/tiles/terrain_snow_cloud_right.png new file mode 100644 index 00000000..75c24c96 Binary files /dev/null and b/examples/tiles/terrain_snow_cloud_right.png differ diff --git a/examples/tiles/terrain_snow_horizontal_left.png b/examples/tiles/terrain_snow_horizontal_left.png new file mode 100644 index 00000000..eba8d783 Binary files /dev/null and b/examples/tiles/terrain_snow_horizontal_left.png differ diff --git a/examples/tiles/terrain_snow_horizontal_middle.png b/examples/tiles/terrain_snow_horizontal_middle.png new file mode 100644 index 00000000..0aec053c Binary files /dev/null and b/examples/tiles/terrain_snow_horizontal_middle.png differ diff --git a/examples/tiles/terrain_snow_horizontal_overhang_left.png b/examples/tiles/terrain_snow_horizontal_overhang_left.png new file mode 100644 index 00000000..83ab8534 Binary files /dev/null and b/examples/tiles/terrain_snow_horizontal_overhang_left.png differ diff --git a/examples/tiles/terrain_snow_horizontal_overhang_right.png b/examples/tiles/terrain_snow_horizontal_overhang_right.png new file mode 100644 index 00000000..e4f25df6 Binary files /dev/null and b/examples/tiles/terrain_snow_horizontal_overhang_right.png differ diff --git a/examples/tiles/terrain_snow_horizontal_right.png b/examples/tiles/terrain_snow_horizontal_right.png new file mode 100644 index 00000000..5d1e59ad Binary files /dev/null and b/examples/tiles/terrain_snow_horizontal_right.png differ diff --git a/examples/tiles/terrain_snow_ramp_long_a.png b/examples/tiles/terrain_snow_ramp_long_a.png new file mode 100644 index 00000000..9a56b157 Binary files /dev/null and b/examples/tiles/terrain_snow_ramp_long_a.png differ diff --git a/examples/tiles/terrain_snow_ramp_long_b.png b/examples/tiles/terrain_snow_ramp_long_b.png new file mode 100644 index 00000000..61e1a250 Binary files /dev/null and b/examples/tiles/terrain_snow_ramp_long_b.png differ diff --git a/examples/tiles/terrain_snow_ramp_long_c.png b/examples/tiles/terrain_snow_ramp_long_c.png new file mode 100644 index 00000000..6ba04cb9 Binary files /dev/null and b/examples/tiles/terrain_snow_ramp_long_c.png differ diff --git a/examples/tiles/terrain_snow_ramp_short_a.png b/examples/tiles/terrain_snow_ramp_short_a.png new file mode 100644 index 00000000..65fb2270 Binary files /dev/null and b/examples/tiles/terrain_snow_ramp_short_a.png differ diff --git a/examples/tiles/terrain_snow_ramp_short_b.png b/examples/tiles/terrain_snow_ramp_short_b.png new file mode 100644 index 00000000..c27db3b6 Binary files /dev/null and b/examples/tiles/terrain_snow_ramp_short_b.png differ diff --git a/examples/tiles/terrain_snow_vertical_bottom.png b/examples/tiles/terrain_snow_vertical_bottom.png new file mode 100644 index 00000000..5a01a3f0 Binary files /dev/null and b/examples/tiles/terrain_snow_vertical_bottom.png differ diff --git a/examples/tiles/terrain_snow_vertical_middle.png b/examples/tiles/terrain_snow_vertical_middle.png new file mode 100644 index 00000000..58a63941 Binary files /dev/null and b/examples/tiles/terrain_snow_vertical_middle.png differ diff --git a/examples/tiles/terrain_snow_vertical_top.png b/examples/tiles/terrain_snow_vertical_top.png new file mode 100644 index 00000000..0c7caf9e Binary files /dev/null and b/examples/tiles/terrain_snow_vertical_top.png differ diff --git a/examples/tiles/terrain_stone_block.png b/examples/tiles/terrain_stone_block.png new file mode 100644 index 00000000..6a0a20dc Binary files /dev/null and b/examples/tiles/terrain_stone_block.png differ diff --git a/examples/tiles/terrain_stone_block_bottom.png b/examples/tiles/terrain_stone_block_bottom.png new file mode 100644 index 00000000..d8276366 Binary files /dev/null and b/examples/tiles/terrain_stone_block_bottom.png differ diff --git a/examples/tiles/terrain_stone_block_bottom_left.png b/examples/tiles/terrain_stone_block_bottom_left.png new file mode 100644 index 00000000..27f49b2b Binary files /dev/null and b/examples/tiles/terrain_stone_block_bottom_left.png differ diff --git a/examples/tiles/terrain_stone_block_bottom_right.png b/examples/tiles/terrain_stone_block_bottom_right.png new file mode 100644 index 00000000..0c313834 Binary files /dev/null and b/examples/tiles/terrain_stone_block_bottom_right.png differ diff --git a/examples/tiles/terrain_stone_block_center.png b/examples/tiles/terrain_stone_block_center.png new file mode 100644 index 00000000..53998ce3 Binary files /dev/null and b/examples/tiles/terrain_stone_block_center.png differ diff --git a/examples/tiles/terrain_stone_block_left.png b/examples/tiles/terrain_stone_block_left.png new file mode 100644 index 00000000..2906e4ff Binary files /dev/null and b/examples/tiles/terrain_stone_block_left.png differ diff --git a/examples/tiles/terrain_stone_block_right.png b/examples/tiles/terrain_stone_block_right.png new file mode 100644 index 00000000..450b3b13 Binary files /dev/null and b/examples/tiles/terrain_stone_block_right.png differ diff --git a/examples/tiles/terrain_stone_block_top.png b/examples/tiles/terrain_stone_block_top.png new file mode 100644 index 00000000..13c2c996 Binary files /dev/null and b/examples/tiles/terrain_stone_block_top.png differ diff --git a/examples/tiles/terrain_stone_block_top_left.png b/examples/tiles/terrain_stone_block_top_left.png new file mode 100644 index 00000000..95afe4de Binary files /dev/null and b/examples/tiles/terrain_stone_block_top_left.png differ diff --git a/examples/tiles/terrain_stone_block_top_right.png b/examples/tiles/terrain_stone_block_top_right.png new file mode 100644 index 00000000..efd49ed2 Binary files /dev/null and b/examples/tiles/terrain_stone_block_top_right.png differ diff --git a/examples/tiles/terrain_stone_cloud.png b/examples/tiles/terrain_stone_cloud.png new file mode 100644 index 00000000..40b1300c Binary files /dev/null and b/examples/tiles/terrain_stone_cloud.png differ diff --git a/examples/tiles/terrain_stone_cloud_background.png b/examples/tiles/terrain_stone_cloud_background.png new file mode 100644 index 00000000..f9213b8a Binary files /dev/null and b/examples/tiles/terrain_stone_cloud_background.png differ diff --git a/examples/tiles/terrain_stone_cloud_left.png b/examples/tiles/terrain_stone_cloud_left.png new file mode 100644 index 00000000..8b2444fb Binary files /dev/null and b/examples/tiles/terrain_stone_cloud_left.png differ diff --git a/examples/tiles/terrain_stone_cloud_middle.png b/examples/tiles/terrain_stone_cloud_middle.png new file mode 100644 index 00000000..577766af Binary files /dev/null and b/examples/tiles/terrain_stone_cloud_middle.png differ diff --git a/examples/tiles/terrain_stone_cloud_right.png b/examples/tiles/terrain_stone_cloud_right.png new file mode 100644 index 00000000..b391b196 Binary files /dev/null and b/examples/tiles/terrain_stone_cloud_right.png differ diff --git a/examples/tiles/terrain_stone_horizontal_left.png b/examples/tiles/terrain_stone_horizontal_left.png new file mode 100644 index 00000000..9b2b797b Binary files /dev/null and b/examples/tiles/terrain_stone_horizontal_left.png differ diff --git a/examples/tiles/terrain_stone_horizontal_middle.png b/examples/tiles/terrain_stone_horizontal_middle.png new file mode 100644 index 00000000..c793fb2d Binary files /dev/null and b/examples/tiles/terrain_stone_horizontal_middle.png differ diff --git a/examples/tiles/terrain_stone_horizontal_overhang_left.png b/examples/tiles/terrain_stone_horizontal_overhang_left.png new file mode 100644 index 00000000..47d158e9 Binary files /dev/null and b/examples/tiles/terrain_stone_horizontal_overhang_left.png differ diff --git a/examples/tiles/terrain_stone_horizontal_overhang_right.png b/examples/tiles/terrain_stone_horizontal_overhang_right.png new file mode 100644 index 00000000..e4cc4ee9 Binary files /dev/null and b/examples/tiles/terrain_stone_horizontal_overhang_right.png differ diff --git a/examples/tiles/terrain_stone_horizontal_right.png b/examples/tiles/terrain_stone_horizontal_right.png new file mode 100644 index 00000000..7e89fe07 Binary files /dev/null and b/examples/tiles/terrain_stone_horizontal_right.png differ diff --git a/examples/tiles/terrain_stone_ramp_long_a.png b/examples/tiles/terrain_stone_ramp_long_a.png new file mode 100644 index 00000000..bafea1cb Binary files /dev/null and b/examples/tiles/terrain_stone_ramp_long_a.png differ diff --git a/examples/tiles/terrain_stone_ramp_long_b.png b/examples/tiles/terrain_stone_ramp_long_b.png new file mode 100644 index 00000000..c240d1c9 Binary files /dev/null and b/examples/tiles/terrain_stone_ramp_long_b.png differ diff --git a/examples/tiles/terrain_stone_ramp_long_c.png b/examples/tiles/terrain_stone_ramp_long_c.png new file mode 100644 index 00000000..2f4b2381 Binary files /dev/null and b/examples/tiles/terrain_stone_ramp_long_c.png differ diff --git a/examples/tiles/terrain_stone_ramp_short_a.png b/examples/tiles/terrain_stone_ramp_short_a.png new file mode 100644 index 00000000..b54b9605 Binary files /dev/null and b/examples/tiles/terrain_stone_ramp_short_a.png differ diff --git a/examples/tiles/terrain_stone_ramp_short_b.png b/examples/tiles/terrain_stone_ramp_short_b.png new file mode 100644 index 00000000..57b6a2b1 Binary files /dev/null and b/examples/tiles/terrain_stone_ramp_short_b.png differ diff --git a/examples/tiles/terrain_stone_vertical_bottom.png b/examples/tiles/terrain_stone_vertical_bottom.png new file mode 100644 index 00000000..f088afef Binary files /dev/null and b/examples/tiles/terrain_stone_vertical_bottom.png differ diff --git a/examples/tiles/terrain_stone_vertical_middle.png b/examples/tiles/terrain_stone_vertical_middle.png new file mode 100644 index 00000000..ae06ec7c Binary files /dev/null and b/examples/tiles/terrain_stone_vertical_middle.png differ diff --git a/examples/tiles/terrain_stone_vertical_top.png b/examples/tiles/terrain_stone_vertical_top.png new file mode 100644 index 00000000..ca55f6d5 Binary files /dev/null and b/examples/tiles/terrain_stone_vertical_top.png differ diff --git a/examples/tiles/torch_off.png b/examples/tiles/torch_off.png new file mode 100644 index 00000000..e36aa936 Binary files /dev/null and b/examples/tiles/torch_off.png differ diff --git a/examples/tiles/torch_on_a.png b/examples/tiles/torch_on_a.png new file mode 100644 index 00000000..7a6ddfb0 Binary files /dev/null and b/examples/tiles/torch_on_a.png differ diff --git a/examples/tiles/torch_on_b.png b/examples/tiles/torch_on_b.png new file mode 100644 index 00000000..ad61c2cc Binary files /dev/null and b/examples/tiles/torch_on_b.png differ diff --git a/examples/tiles/water.png b/examples/tiles/water.png new file mode 100644 index 00000000..d901cb6b Binary files /dev/null and b/examples/tiles/water.png differ diff --git a/examples/tiles/water_top.png b/examples/tiles/water_top.png new file mode 100644 index 00000000..92d02f53 Binary files /dev/null and b/examples/tiles/water_top.png differ diff --git a/examples/tiles/water_top_low.png b/examples/tiles/water_top_low.png new file mode 100644 index 00000000..dc47c213 Binary files /dev/null and b/examples/tiles/water_top_low.png differ diff --git a/examples/tiles/weight.png b/examples/tiles/weight.png new file mode 100644 index 00000000..74ddf67b Binary files /dev/null and b/examples/tiles/weight.png differ diff --git a/examples/tiles/window.png b/examples/tiles/window.png new file mode 100644 index 00000000..0a78e49f Binary files /dev/null and b/examples/tiles/window.png differ diff --git a/film2d.cm b/film2d.cm index 025370d5..4316b91b 100644 --- a/film2d.cm +++ b/film2d.cm @@ -253,7 +253,7 @@ film2d.query = function(selector) { } // All drawables - var draws = array(registry, id => registry[id]) + var draws = array(array(registry), id => registry[id]) result = array(result, filter(draws, d => d.visible != false)) return result } diff --git a/fx_graph.cm b/fx_graph.cm index 6d8978ce..bf1ecadc 100644 --- a/fx_graph.cm +++ b/fx_graph.cm @@ -58,6 +58,7 @@ // Output: {commands} var fx_graph = {} +var NODE_EXECUTORS = {} fx_graph.add_node = function(type, params) { var local_params = params || {} @@ -77,29 +78,30 @@ fx_graph.set_output = function(output_handle) { // Execute graph using backend fx_graph.execute = function(backend) { - var sorted = this.topological_sort() + var self = this + var sorted = self.topological_sort() var node_outputs = {} var all_commands = [] - + arrfor(sorted, function(node) { var executor = NODE_EXECUTORS[node.type] if (!executor) { log.console(`fx_graph: No executor for node type: ${node.type}`) return } - - var resolved_params = this.resolve_inputs(node.params, node_outputs) + + var resolved_params = self.resolve_inputs(node.params, node_outputs) resolved_params._node_id = node.id - + var result = executor(resolved_params, backend) node_outputs[node.id] = result - + // Collect commands from this node if (result && result.commands) { all_commands = array(all_commands, result.commands) } }) - + return {commands: all_commands} } @@ -126,8 +128,6 @@ fx_graph.topological_sort = function() { // NODE EXECUTORS // ======================================================================== -var NODE_EXECUTORS = {} - // render_view: Render scene tree to target using a renderer NODE_EXECUTORS.render_view = function(params, backend) { var root = params.root @@ -385,8 +385,8 @@ function fit_to_screen(target_spec, window_size) { return {x: x, y: y, width: w, height: h} } -// Export fit_to_screen for external use fx_graph.fit_to_screen = fit_to_screen + function make_fxgraph() { return meme(fx_graph, { nodes: [], @@ -395,6 +395,7 @@ function make_fxgraph() { }) } -make_fxgraph.fit_to_screen = fit_to_screen - -return make_fxgraph +return { + create: make_fxgraph, + fit_to_screen: fit_to_screen +} diff --git a/graphics.cm b/graphics.cm index 11f83023..8efb7967 100644 --- a/graphics.cm +++ b/graphics.cm @@ -286,7 +286,7 @@ graphics.texture = function texture(path) { ipath = res.find_image(id) if (!ipath) { - // If still not found, return notex + if (id == 'notex') return null return graphics.texture('notex') } diff --git a/particles2d.cm b/particles2d.cm index f223f23b..b8deb2f0 100644 --- a/particles2d.cm +++ b/particles2d.cm @@ -137,7 +137,7 @@ var factory = function(props) { return newparticles } -// Attach emitter helpers to factory -factory.emitters = emitters - -return factory \ No newline at end of file +return { + create: factory, + emitters: emitters +} \ No newline at end of file