diff --git a/scripts/core/_sdl_video.js b/moth/_sdl_video.js similarity index 100% rename from scripts/core/_sdl_video.js rename to moth/_sdl_video.js diff --git a/scripts/modules/ext/camera.js b/moth/camera.js similarity index 100% rename from scripts/modules/ext/camera.js rename to moth/camera.js diff --git a/scripts/modules/ext/clay.js b/moth/clay.js similarity index 100% rename from scripts/modules/ext/clay.js rename to moth/clay.js diff --git a/scripts/modules/color.js b/moth/color.js similarity index 100% rename from scripts/modules/color.js rename to moth/color.js diff --git a/scripts/modules/ext/controller.js b/moth/controller.js similarity index 100% rename from scripts/modules/ext/controller.js rename to moth/controller.js diff --git a/scripts/modules/device.js b/moth/device.js similarity index 100% rename from scripts/modules/device.js rename to moth/device.js diff --git a/scripts/modules/draw2d.js b/moth/draw2d.js similarity index 100% rename from scripts/modules/draw2d.js rename to moth/draw2d.js diff --git a/tests/dull.js b/moth/dull.js similarity index 100% rename from tests/dull.js rename to moth/dull.js diff --git a/scripts/modules/ext/emitter.js b/moth/emitter.js similarity index 100% rename from scripts/modules/ext/emitter.js rename to moth/emitter.js diff --git a/examples/bunnymark/bunny.png b/moth/examples/bunnymark/bunny.png similarity index 100% rename from examples/bunnymark/bunny.png rename to moth/examples/bunnymark/bunny.png diff --git a/examples/bunnymark/config.js b/moth/examples/bunnymark/config.js similarity index 100% rename from examples/bunnymark/config.js rename to moth/examples/bunnymark/config.js diff --git a/examples/bunnymark/main.js b/moth/examples/bunnymark/main.js similarity index 100% rename from examples/bunnymark/main.js rename to moth/examples/bunnymark/main.js diff --git a/examples/chess/black_bishop.png b/moth/examples/chess/black_bishop.png similarity index 100% rename from examples/chess/black_bishop.png rename to moth/examples/chess/black_bishop.png diff --git a/examples/chess/black_king.png b/moth/examples/chess/black_king.png similarity index 100% rename from examples/chess/black_king.png rename to moth/examples/chess/black_king.png diff --git a/examples/chess/black_knight.png b/moth/examples/chess/black_knight.png similarity index 100% rename from examples/chess/black_knight.png rename to moth/examples/chess/black_knight.png diff --git a/examples/chess/black_pawn.png b/moth/examples/chess/black_pawn.png similarity index 100% rename from examples/chess/black_pawn.png rename to moth/examples/chess/black_pawn.png diff --git a/examples/chess/black_queen.png b/moth/examples/chess/black_queen.png similarity index 100% rename from examples/chess/black_queen.png rename to moth/examples/chess/black_queen.png diff --git a/examples/chess/black_rook.png b/moth/examples/chess/black_rook.png similarity index 100% rename from examples/chess/black_rook.png rename to moth/examples/chess/black_rook.png diff --git a/examples/chess/config.js b/moth/examples/chess/config.js similarity index 100% rename from examples/chess/config.js rename to moth/examples/chess/config.js diff --git a/examples/chess/grid.js b/moth/examples/chess/grid.js similarity index 100% rename from examples/chess/grid.js rename to moth/examples/chess/grid.js diff --git a/examples/chess/main.js b/moth/examples/chess/main.js similarity index 100% rename from examples/chess/main.js rename to moth/examples/chess/main.js diff --git a/examples/chess/movement.js b/moth/examples/chess/movement.js similarity index 100% rename from examples/chess/movement.js rename to moth/examples/chess/movement.js diff --git a/examples/chess/pieces.js b/moth/examples/chess/pieces.js similarity index 100% rename from examples/chess/pieces.js rename to moth/examples/chess/pieces.js diff --git a/examples/chess/prosperon b/moth/examples/chess/prosperon similarity index 100% rename from examples/chess/prosperon rename to moth/examples/chess/prosperon diff --git a/examples/chess/rules.js b/moth/examples/chess/rules.js similarity index 100% rename from examples/chess/rules.js rename to moth/examples/chess/rules.js diff --git a/examples/chess/white_bishop.png b/moth/examples/chess/white_bishop.png similarity index 100% rename from examples/chess/white_bishop.png rename to moth/examples/chess/white_bishop.png diff --git a/examples/chess/white_king.png b/moth/examples/chess/white_king.png similarity index 100% rename from examples/chess/white_king.png rename to moth/examples/chess/white_king.png diff --git a/examples/chess/white_knight.png b/moth/examples/chess/white_knight.png similarity index 100% rename from examples/chess/white_knight.png rename to moth/examples/chess/white_knight.png diff --git a/examples/chess/white_pawn.png b/moth/examples/chess/white_pawn.png similarity index 100% rename from examples/chess/white_pawn.png rename to moth/examples/chess/white_pawn.png diff --git a/examples/chess/white_queen.png b/moth/examples/chess/white_queen.png similarity index 100% rename from examples/chess/white_queen.png rename to moth/examples/chess/white_queen.png diff --git a/examples/chess/white_rook.png b/moth/examples/chess/white_rook.png similarity index 100% rename from examples/chess/white_rook.png rename to moth/examples/chess/white_rook.png diff --git a/examples/pong/config.js b/moth/examples/pong/config.js similarity index 100% rename from examples/pong/config.js rename to moth/examples/pong/config.js diff --git a/examples/pong/main.js b/moth/examples/pong/main.js similarity index 100% rename from examples/pong/main.js rename to moth/examples/pong/main.js diff --git a/examples/snake/config.js b/moth/examples/snake/config.js similarity index 100% rename from examples/snake/config.js rename to moth/examples/snake/config.js diff --git a/examples/snake/main.js b/moth/examples/snake/main.js similarity index 100% rename from examples/snake/main.js rename to moth/examples/snake/main.js diff --git a/examples/steam_example.js b/moth/examples/steam_example.js similarity index 100% rename from examples/steam_example.js rename to moth/examples/steam_example.js diff --git a/examples/tetris/config.js b/moth/examples/tetris/config.js similarity index 100% rename from examples/tetris/config.js rename to moth/examples/tetris/config.js diff --git a/examples/tetris/main.js b/moth/examples/tetris/main.js similarity index 100% rename from examples/tetris/main.js rename to moth/examples/tetris/main.js diff --git a/fonts/c64.ttf b/moth/fonts/c64.ttf similarity index 100% rename from fonts/c64.ttf rename to moth/fonts/c64.ttf diff --git a/fonts/dos.ttf b/moth/fonts/dos.ttf similarity index 100% rename from fonts/dos.ttf rename to moth/fonts/dos.ttf diff --git a/fonts/teenytinypixels.ttf b/moth/fonts/teenytinypixels.ttf similarity index 100% rename from fonts/teenytinypixels.ttf rename to moth/fonts/teenytinypixels.ttf diff --git a/scripts/modules/geometry.js b/moth/geometry.js similarity index 100% rename from scripts/modules/geometry.js rename to moth/geometry.js diff --git a/scripts/modules/graphics.js b/moth/graphics.js similarity index 100% rename from scripts/modules/graphics.js rename to moth/graphics.js diff --git a/icons/moon.gif b/moth/icons/moon.gif similarity index 100% rename from icons/moon.gif rename to moth/icons/moon.gif diff --git a/icons/no_tex.gif b/moth/icons/no_tex.gif similarity index 100% rename from icons/no_tex.gif rename to moth/icons/no_tex.gif diff --git a/icons_dev/airplane.png b/moth/icons_dev/airplane.png similarity index 100% rename from icons_dev/airplane.png rename to moth/icons_dev/airplane.png diff --git a/icons_dev/ak47.png b/moth/icons_dev/ak47.png similarity index 100% rename from icons_dev/ak47.png rename to moth/icons_dev/ak47.png diff --git a/icons_dev/amputation.png b/moth/icons_dev/amputation.png similarity index 100% rename from icons_dev/amputation.png rename to moth/icons_dev/amputation.png diff --git a/icons_dev/ant.png b/moth/icons_dev/ant.png similarity index 100% rename from icons_dev/ant.png rename to moth/icons_dev/ant.png diff --git a/icons_dev/archer.png b/moth/icons_dev/archer.png similarity index 100% rename from icons_dev/archer.png rename to moth/icons_dev/archer.png diff --git a/icons_dev/armadillo.png b/moth/icons_dev/armadillo.png similarity index 100% rename from icons_dev/armadillo.png rename to moth/icons_dev/armadillo.png diff --git a/icons_dev/atom.png b/moth/icons_dev/atom.png similarity index 100% rename from icons_dev/atom.png rename to moth/icons_dev/atom.png diff --git a/icons_dev/banana.png b/moth/icons_dev/banana.png similarity index 100% rename from icons_dev/banana.png rename to moth/icons_dev/banana.png diff --git a/icons_dev/bank.png b/moth/icons_dev/bank.png similarity index 100% rename from icons_dev/bank.png rename to moth/icons_dev/bank.png diff --git a/icons_dev/banknote.png b/moth/icons_dev/banknote.png similarity index 100% rename from icons_dev/banknote.png rename to moth/icons_dev/banknote.png diff --git a/icons_dev/barn.png b/moth/icons_dev/barn.png similarity index 100% rename from icons_dev/barn.png rename to moth/icons_dev/barn.png diff --git a/icons_dev/barrel.png b/moth/icons_dev/barrel.png similarity index 100% rename from icons_dev/barrel.png rename to moth/icons_dev/barrel.png diff --git a/icons_dev/basket.png b/moth/icons_dev/basket.png similarity index 100% rename from icons_dev/basket.png rename to moth/icons_dev/basket.png diff --git a/icons_dev/bat.png b/moth/icons_dev/bat.png similarity index 100% rename from icons_dev/bat.png rename to moth/icons_dev/bat.png diff --git a/icons_dev/bed.png b/moth/icons_dev/bed.png similarity index 100% rename from icons_dev/bed.png rename to moth/icons_dev/bed.png diff --git a/icons_dev/belt.png b/moth/icons_dev/belt.png similarity index 100% rename from icons_dev/belt.png rename to moth/icons_dev/belt.png diff --git a/icons_dev/boar.png b/moth/icons_dev/boar.png similarity index 100% rename from icons_dev/boar.png rename to moth/icons_dev/boar.png diff --git a/icons_dev/broom.png b/moth/icons_dev/broom.png similarity index 100% rename from icons_dev/broom.png rename to moth/icons_dev/broom.png diff --git a/icons_dev/cabin.png b/moth/icons_dev/cabin.png similarity index 100% rename from icons_dev/cabin.png rename to moth/icons_dev/cabin.png diff --git a/icons_dev/card-10-clubs.png b/moth/icons_dev/card-10-clubs.png similarity index 100% rename from icons_dev/card-10-clubs.png rename to moth/icons_dev/card-10-clubs.png diff --git a/icons_dev/card-10-diamonds.png b/moth/icons_dev/card-10-diamonds.png similarity index 100% rename from icons_dev/card-10-diamonds.png rename to moth/icons_dev/card-10-diamonds.png diff --git a/icons_dev/card-10-hearts.png b/moth/icons_dev/card-10-hearts.png similarity index 100% rename from icons_dev/card-10-hearts.png rename to moth/icons_dev/card-10-hearts.png diff --git a/icons_dev/card-10-spades.png b/moth/icons_dev/card-10-spades.png similarity index 100% rename from icons_dev/card-10-spades.png rename to moth/icons_dev/card-10-spades.png diff --git a/icons_dev/card-2-clubs.png b/moth/icons_dev/card-2-clubs.png similarity index 100% rename from icons_dev/card-2-clubs.png rename to moth/icons_dev/card-2-clubs.png diff --git a/icons_dev/card-2-diamonds.png b/moth/icons_dev/card-2-diamonds.png similarity index 100% rename from icons_dev/card-2-diamonds.png rename to moth/icons_dev/card-2-diamonds.png diff --git a/icons_dev/card-2-hearts.png b/moth/icons_dev/card-2-hearts.png similarity index 100% rename from icons_dev/card-2-hearts.png rename to moth/icons_dev/card-2-hearts.png diff --git a/icons_dev/card-2-spades.png b/moth/icons_dev/card-2-spades.png similarity index 100% rename from icons_dev/card-2-spades.png rename to moth/icons_dev/card-2-spades.png diff --git a/icons_dev/card-3-clubs.png b/moth/icons_dev/card-3-clubs.png similarity index 100% rename from icons_dev/card-3-clubs.png rename to moth/icons_dev/card-3-clubs.png diff --git a/icons_dev/card-3-diamonds.png b/moth/icons_dev/card-3-diamonds.png similarity index 100% rename from icons_dev/card-3-diamonds.png rename to moth/icons_dev/card-3-diamonds.png diff --git a/icons_dev/card-3-hearts.png b/moth/icons_dev/card-3-hearts.png similarity index 100% rename from icons_dev/card-3-hearts.png rename to moth/icons_dev/card-3-hearts.png diff --git a/icons_dev/card-3-spades.png b/moth/icons_dev/card-3-spades.png similarity index 100% rename from icons_dev/card-3-spades.png rename to moth/icons_dev/card-3-spades.png diff --git a/icons_dev/card-4-clubs.png b/moth/icons_dev/card-4-clubs.png similarity index 100% rename from icons_dev/card-4-clubs.png rename to moth/icons_dev/card-4-clubs.png diff --git a/icons_dev/card-4-diamonds.png b/moth/icons_dev/card-4-diamonds.png similarity index 100% rename from icons_dev/card-4-diamonds.png rename to moth/icons_dev/card-4-diamonds.png diff --git a/icons_dev/card-4-hearts.png b/moth/icons_dev/card-4-hearts.png similarity index 100% rename from icons_dev/card-4-hearts.png rename to moth/icons_dev/card-4-hearts.png diff --git a/icons_dev/card-4-spades.png b/moth/icons_dev/card-4-spades.png similarity index 100% rename from icons_dev/card-4-spades.png rename to moth/icons_dev/card-4-spades.png diff --git a/icons_dev/card-5-clubs.png b/moth/icons_dev/card-5-clubs.png similarity index 100% rename from icons_dev/card-5-clubs.png rename to moth/icons_dev/card-5-clubs.png diff --git a/icons_dev/card-5-diamonds.png b/moth/icons_dev/card-5-diamonds.png similarity index 100% rename from icons_dev/card-5-diamonds.png rename to moth/icons_dev/card-5-diamonds.png diff --git a/icons_dev/card-5-hearts.png b/moth/icons_dev/card-5-hearts.png similarity index 100% rename from icons_dev/card-5-hearts.png rename to moth/icons_dev/card-5-hearts.png diff --git a/icons_dev/card-5-spades.png b/moth/icons_dev/card-5-spades.png similarity index 100% rename from icons_dev/card-5-spades.png rename to moth/icons_dev/card-5-spades.png diff --git a/icons_dev/card-6-clubs.png b/moth/icons_dev/card-6-clubs.png similarity index 100% rename from icons_dev/card-6-clubs.png rename to moth/icons_dev/card-6-clubs.png diff --git a/icons_dev/card-6-diamonds.png b/moth/icons_dev/card-6-diamonds.png similarity index 100% rename from icons_dev/card-6-diamonds.png rename to moth/icons_dev/card-6-diamonds.png diff --git a/icons_dev/card-6-hearts.png b/moth/icons_dev/card-6-hearts.png similarity index 100% rename from icons_dev/card-6-hearts.png rename to moth/icons_dev/card-6-hearts.png diff --git a/icons_dev/card-6-spades.png b/moth/icons_dev/card-6-spades.png similarity index 100% rename from icons_dev/card-6-spades.png rename to moth/icons_dev/card-6-spades.png diff --git a/icons_dev/card-7-clubs.png b/moth/icons_dev/card-7-clubs.png similarity index 100% rename from icons_dev/card-7-clubs.png rename to moth/icons_dev/card-7-clubs.png diff --git a/icons_dev/card-7-diamonds.png b/moth/icons_dev/card-7-diamonds.png similarity index 100% rename from icons_dev/card-7-diamonds.png rename to moth/icons_dev/card-7-diamonds.png diff --git a/icons_dev/card-7-hearts.png b/moth/icons_dev/card-7-hearts.png similarity index 100% rename from icons_dev/card-7-hearts.png rename to moth/icons_dev/card-7-hearts.png diff --git a/icons_dev/card-7-spades.png b/moth/icons_dev/card-7-spades.png similarity index 100% rename from icons_dev/card-7-spades.png rename to moth/icons_dev/card-7-spades.png diff --git a/icons_dev/card-8-clubs.png b/moth/icons_dev/card-8-clubs.png similarity index 100% rename from icons_dev/card-8-clubs.png rename to moth/icons_dev/card-8-clubs.png diff --git a/icons_dev/card-8-diamonds.png b/moth/icons_dev/card-8-diamonds.png similarity index 100% rename from icons_dev/card-8-diamonds.png rename to moth/icons_dev/card-8-diamonds.png diff --git a/icons_dev/card-8-hearts.png b/moth/icons_dev/card-8-hearts.png similarity index 100% rename from icons_dev/card-8-hearts.png rename to moth/icons_dev/card-8-hearts.png diff --git a/icons_dev/card-8-spades.png b/moth/icons_dev/card-8-spades.png similarity index 100% rename from icons_dev/card-8-spades.png rename to moth/icons_dev/card-8-spades.png diff --git a/icons_dev/card-9-clubs.png b/moth/icons_dev/card-9-clubs.png similarity index 100% rename from icons_dev/card-9-clubs.png rename to moth/icons_dev/card-9-clubs.png diff --git a/icons_dev/card-9-diamonds.png b/moth/icons_dev/card-9-diamonds.png similarity index 100% rename from icons_dev/card-9-diamonds.png rename to moth/icons_dev/card-9-diamonds.png diff --git a/icons_dev/card-9-hearts.png b/moth/icons_dev/card-9-hearts.png similarity index 100% rename from icons_dev/card-9-hearts.png rename to moth/icons_dev/card-9-hearts.png diff --git a/icons_dev/card-9-spades.png b/moth/icons_dev/card-9-spades.png similarity index 100% rename from icons_dev/card-9-spades.png rename to moth/icons_dev/card-9-spades.png diff --git a/icons_dev/card-ace-clubs.png b/moth/icons_dev/card-ace-clubs.png similarity index 100% rename from icons_dev/card-ace-clubs.png rename to moth/icons_dev/card-ace-clubs.png diff --git a/icons_dev/card-ace-diamonds.png b/moth/icons_dev/card-ace-diamonds.png similarity index 100% rename from icons_dev/card-ace-diamonds.png rename to moth/icons_dev/card-ace-diamonds.png diff --git a/icons_dev/card-ace-hearts.png b/moth/icons_dev/card-ace-hearts.png similarity index 100% rename from icons_dev/card-ace-hearts.png rename to moth/icons_dev/card-ace-hearts.png diff --git a/icons_dev/card-ace-spades.png b/moth/icons_dev/card-ace-spades.png similarity index 100% rename from icons_dev/card-ace-spades.png rename to moth/icons_dev/card-ace-spades.png diff --git a/icons_dev/card-discard.png b/moth/icons_dev/card-discard.png similarity index 100% rename from icons_dev/card-discard.png rename to moth/icons_dev/card-discard.png diff --git a/icons_dev/card-draw.png b/moth/icons_dev/card-draw.png similarity index 100% rename from icons_dev/card-draw.png rename to moth/icons_dev/card-draw.png diff --git a/icons_dev/card-jack-clubs.png b/moth/icons_dev/card-jack-clubs.png similarity index 100% rename from icons_dev/card-jack-clubs.png rename to moth/icons_dev/card-jack-clubs.png diff --git a/icons_dev/card-jack-diamonds.png b/moth/icons_dev/card-jack-diamonds.png similarity index 100% rename from icons_dev/card-jack-diamonds.png rename to moth/icons_dev/card-jack-diamonds.png diff --git a/icons_dev/card-jack-hearts.png b/moth/icons_dev/card-jack-hearts.png similarity index 100% rename from icons_dev/card-jack-hearts.png rename to moth/icons_dev/card-jack-hearts.png diff --git a/icons_dev/card-jack-spades.png b/moth/icons_dev/card-jack-spades.png similarity index 100% rename from icons_dev/card-jack-spades.png rename to moth/icons_dev/card-jack-spades.png diff --git a/icons_dev/card-joker.png b/moth/icons_dev/card-joker.png similarity index 100% rename from icons_dev/card-joker.png rename to moth/icons_dev/card-joker.png diff --git a/icons_dev/card-king-clubs.png b/moth/icons_dev/card-king-clubs.png similarity index 100% rename from icons_dev/card-king-clubs.png rename to moth/icons_dev/card-king-clubs.png diff --git a/icons_dev/card-king-diamonds.png b/moth/icons_dev/card-king-diamonds.png similarity index 100% rename from icons_dev/card-king-diamonds.png rename to moth/icons_dev/card-king-diamonds.png diff --git a/icons_dev/card-king-hearts.png b/moth/icons_dev/card-king-hearts.png similarity index 100% rename from icons_dev/card-king-hearts.png rename to moth/icons_dev/card-king-hearts.png diff --git a/icons_dev/card-king-spades.png b/moth/icons_dev/card-king-spades.png similarity index 100% rename from icons_dev/card-king-spades.png rename to moth/icons_dev/card-king-spades.png diff --git a/icons_dev/card-pick.png b/moth/icons_dev/card-pick.png similarity index 100% rename from icons_dev/card-pick.png rename to moth/icons_dev/card-pick.png diff --git a/icons_dev/card-queen-clubs.png b/moth/icons_dev/card-queen-clubs.png similarity index 100% rename from icons_dev/card-queen-clubs.png rename to moth/icons_dev/card-queen-clubs.png diff --git a/icons_dev/card-queen-diamonds.png b/moth/icons_dev/card-queen-diamonds.png similarity index 100% rename from icons_dev/card-queen-diamonds.png rename to moth/icons_dev/card-queen-diamonds.png diff --git a/icons_dev/card-queen-hearts.png b/moth/icons_dev/card-queen-hearts.png similarity index 100% rename from icons_dev/card-queen-hearts.png rename to moth/icons_dev/card-queen-hearts.png diff --git a/icons_dev/card-queen-spades.png b/moth/icons_dev/card-queen-spades.png similarity index 100% rename from icons_dev/card-queen-spades.png rename to moth/icons_dev/card-queen-spades.png diff --git a/icons_dev/card-random.png b/moth/icons_dev/card-random.png similarity index 100% rename from icons_dev/card-random.png rename to moth/icons_dev/card-random.png diff --git a/icons_dev/chess-bishop.png b/moth/icons_dev/chess-bishop.png similarity index 100% rename from icons_dev/chess-bishop.png rename to moth/icons_dev/chess-bishop.png diff --git a/icons_dev/chess-king.png b/moth/icons_dev/chess-king.png similarity index 100% rename from icons_dev/chess-king.png rename to moth/icons_dev/chess-king.png diff --git a/icons_dev/chess-knight.png b/moth/icons_dev/chess-knight.png similarity index 100% rename from icons_dev/chess-knight.png rename to moth/icons_dev/chess-knight.png diff --git a/icons_dev/chess-pawn.png b/moth/icons_dev/chess-pawn.png similarity index 100% rename from icons_dev/chess-pawn.png rename to moth/icons_dev/chess-pawn.png diff --git a/icons_dev/chess-queen.png b/moth/icons_dev/chess-queen.png similarity index 100% rename from icons_dev/chess-queen.png rename to moth/icons_dev/chess-queen.png diff --git a/icons_dev/chess-rook.png b/moth/icons_dev/chess-rook.png similarity index 100% rename from icons_dev/chess-rook.png rename to moth/icons_dev/chess-rook.png diff --git a/icons_dev/chicken.png b/moth/icons_dev/chicken.png similarity index 100% rename from icons_dev/chicken.png rename to moth/icons_dev/chicken.png diff --git a/icons_dev/clarinet.png b/moth/icons_dev/clarinet.png similarity index 100% rename from icons_dev/clarinet.png rename to moth/icons_dev/clarinet.png diff --git a/icons_dev/cloak.png b/moth/icons_dev/cloak.png similarity index 100% rename from icons_dev/cloak.png rename to moth/icons_dev/cloak.png diff --git a/icons_dev/clown.png b/moth/icons_dev/clown.png similarity index 100% rename from icons_dev/clown.png rename to moth/icons_dev/clown.png diff --git a/icons_dev/coins.png b/moth/icons_dev/coins.png similarity index 100% rename from icons_dev/coins.png rename to moth/icons_dev/coins.png diff --git a/icons_dev/compass.png b/moth/icons_dev/compass.png similarity index 100% rename from icons_dev/compass.png rename to moth/icons_dev/compass.png diff --git a/icons_dev/cow.png b/moth/icons_dev/cow.png similarity index 100% rename from icons_dev/cow.png rename to moth/icons_dev/cow.png diff --git a/icons_dev/crossed-swords.png b/moth/icons_dev/crossed-swords.png similarity index 100% rename from icons_dev/crossed-swords.png rename to moth/icons_dev/crossed-swords.png diff --git a/icons_dev/deer.png b/moth/icons_dev/deer.png similarity index 100% rename from icons_dev/deer.png rename to moth/icons_dev/deer.png diff --git a/icons_dev/dice.png b/moth/icons_dev/dice.png similarity index 100% rename from icons_dev/dice.png rename to moth/icons_dev/dice.png diff --git a/icons_dev/dodo.png b/moth/icons_dev/dodo.png similarity index 100% rename from icons_dev/dodo.png rename to moth/icons_dev/dodo.png diff --git a/icons_dev/donkey.png b/moth/icons_dev/donkey.png similarity index 100% rename from icons_dev/donkey.png rename to moth/icons_dev/donkey.png diff --git a/icons_dev/door.png b/moth/icons_dev/door.png similarity index 100% rename from icons_dev/door.png rename to moth/icons_dev/door.png diff --git a/icons_dev/duck.png b/moth/icons_dev/duck.png similarity index 100% rename from icons_dev/duck.png rename to moth/icons_dev/duck.png diff --git a/icons_dev/dynamite.png b/moth/icons_dev/dynamite.png similarity index 100% rename from icons_dev/dynamite.png rename to moth/icons_dev/dynamite.png diff --git a/icons_dev/f-clef.png b/moth/icons_dev/f-clef.png similarity index 100% rename from icons_dev/f-clef.png rename to moth/icons_dev/f-clef.png diff --git a/icons_dev/fairy.png b/moth/icons_dev/fairy.png similarity index 100% rename from icons_dev/fairy.png rename to moth/icons_dev/fairy.png diff --git a/icons_dev/fangs.png b/moth/icons_dev/fangs.png similarity index 100% rename from icons_dev/fangs.png rename to moth/icons_dev/fangs.png diff --git a/icons_dev/fez.png b/moth/icons_dev/fez.png similarity index 100% rename from icons_dev/fez.png rename to moth/icons_dev/fez.png diff --git a/icons_dev/files.png b/moth/icons_dev/files.png similarity index 100% rename from icons_dev/files.png rename to moth/icons_dev/files.png diff --git a/icons_dev/finch.png b/moth/icons_dev/finch.png similarity index 100% rename from icons_dev/finch.png rename to moth/icons_dev/finch.png diff --git a/icons_dev/fire.png b/moth/icons_dev/fire.png similarity index 100% rename from icons_dev/fire.png rename to moth/icons_dev/fire.png diff --git a/icons_dev/flashlight.png b/moth/icons_dev/flashlight.png similarity index 100% rename from icons_dev/flashlight.png rename to moth/icons_dev/flashlight.png diff --git a/icons_dev/footsteps.png b/moth/icons_dev/footsteps.png similarity index 100% rename from icons_dev/footsteps.png rename to moth/icons_dev/footsteps.png diff --git a/icons_dev/forest.png b/moth/icons_dev/forest.png similarity index 100% rename from icons_dev/forest.png rename to moth/icons_dev/forest.png diff --git a/icons_dev/fox.png b/moth/icons_dev/fox.png similarity index 100% rename from icons_dev/fox.png rename to moth/icons_dev/fox.png diff --git a/icons_dev/fuji.png b/moth/icons_dev/fuji.png similarity index 100% rename from icons_dev/fuji.png rename to moth/icons_dev/fuji.png diff --git a/icons_dev/g-clef.png b/moth/icons_dev/g-clef.png similarity index 100% rename from icons_dev/g-clef.png rename to moth/icons_dev/g-clef.png diff --git a/icons_dev/gargoyle.png b/moth/icons_dev/gargoyle.png similarity index 100% rename from icons_dev/gargoyle.png rename to moth/icons_dev/gargoyle.png diff --git a/icons_dev/garlic.png b/moth/icons_dev/garlic.png similarity index 100% rename from icons_dev/garlic.png rename to moth/icons_dev/garlic.png diff --git a/icons_dev/gasmask.png b/moth/icons_dev/gasmask.png similarity index 100% rename from icons_dev/gasmask.png rename to moth/icons_dev/gasmask.png diff --git a/icons_dev/gate.png b/moth/icons_dev/gate.png similarity index 100% rename from icons_dev/gate.png rename to moth/icons_dev/gate.png diff --git a/icons_dev/goblin.png b/moth/icons_dev/goblin.png similarity index 100% rename from icons_dev/goblin.png rename to moth/icons_dev/goblin.png diff --git a/icons_dev/goose.png b/moth/icons_dev/goose.png similarity index 100% rename from icons_dev/goose.png rename to moth/icons_dev/goose.png diff --git a/icons_dev/gorilla.png b/moth/icons_dev/gorilla.png similarity index 100% rename from icons_dev/gorilla.png rename to moth/icons_dev/gorilla.png diff --git a/icons_dev/grass.png b/moth/icons_dev/grass.png similarity index 100% rename from icons_dev/grass.png rename to moth/icons_dev/grass.png diff --git a/icons_dev/harp.png b/moth/icons_dev/harp.png similarity index 100% rename from icons_dev/harp.png rename to moth/icons_dev/harp.png diff --git a/icons_dev/hatchet.png b/moth/icons_dev/hatchet.png similarity index 100% rename from icons_dev/hatchet.png rename to moth/icons_dev/hatchet.png diff --git a/icons_dev/heart.png b/moth/icons_dev/heart.png similarity index 100% rename from icons_dev/heart.png rename to moth/icons_dev/heart.png diff --git a/icons_dev/hedgehog.png b/moth/icons_dev/hedgehog.png similarity index 100% rename from icons_dev/hedgehog.png rename to moth/icons_dev/hedgehog.png diff --git a/icons_dev/heron.png b/moth/icons_dev/heron.png similarity index 100% rename from icons_dev/heron.png rename to moth/icons_dev/heron.png diff --git a/icons_dev/hook.png b/moth/icons_dev/hook.png similarity index 100% rename from icons_dev/hook.png rename to moth/icons_dev/hook.png diff --git a/icons_dev/hotdog.png b/moth/icons_dev/hotdog.png similarity index 100% rename from icons_dev/hotdog.png rename to moth/icons_dev/hotdog.png diff --git a/icons_dev/info.png b/moth/icons_dev/info.png similarity index 100% rename from icons_dev/info.png rename to moth/icons_dev/info.png diff --git a/icons_dev/key.png b/moth/icons_dev/key.png similarity index 100% rename from icons_dev/key.png rename to moth/icons_dev/key.png diff --git a/icons_dev/kite.png b/moth/icons_dev/kite.png similarity index 100% rename from icons_dev/kite.png rename to moth/icons_dev/kite.png diff --git a/icons_dev/ladder.png b/moth/icons_dev/ladder.png similarity index 100% rename from icons_dev/ladder.png rename to moth/icons_dev/ladder.png diff --git a/icons_dev/lambda.png b/moth/icons_dev/lambda.png similarity index 100% rename from icons_dev/lambda.png rename to moth/icons_dev/lambda.png diff --git a/icons_dev/led.png b/moth/icons_dev/led.png similarity index 100% rename from icons_dev/led.png rename to moth/icons_dev/led.png diff --git a/icons_dev/lemon.png b/moth/icons_dev/lemon.png similarity index 100% rename from icons_dev/lemon.png rename to moth/icons_dev/lemon.png diff --git a/icons_dev/log.png b/moth/icons_dev/log.png similarity index 100% rename from icons_dev/log.png rename to moth/icons_dev/log.png diff --git a/icons_dev/maracas.png b/moth/icons_dev/maracas.png similarity index 100% rename from icons_dev/maracas.png rename to moth/icons_dev/maracas.png diff --git a/icons_dev/moai.png b/moth/icons_dev/moai.png similarity index 100% rename from icons_dev/moai.png rename to moth/icons_dev/moai.png diff --git a/icons_dev/mole.png b/moth/icons_dev/mole.png similarity index 100% rename from icons_dev/mole.png rename to moth/icons_dev/mole.png diff --git a/icons_dev/mouse.png b/moth/icons_dev/mouse.png similarity index 100% rename from icons_dev/mouse.png rename to moth/icons_dev/mouse.png diff --git a/icons_dev/move.png b/moth/icons_dev/move.png similarity index 100% rename from icons_dev/move.png rename to moth/icons_dev/move.png diff --git a/icons_dev/necklace.png b/moth/icons_dev/necklace.png similarity index 100% rename from icons_dev/necklace.png rename to moth/icons_dev/necklace.png diff --git a/icons_dev/ocarina.png b/moth/icons_dev/ocarina.png similarity index 100% rename from icons_dev/ocarina.png rename to moth/icons_dev/ocarina.png diff --git a/icons_dev/panflute.png b/moth/icons_dev/panflute.png similarity index 100% rename from icons_dev/panflute.png rename to moth/icons_dev/panflute.png diff --git a/icons_dev/pangolin.png b/moth/icons_dev/pangolin.png similarity index 100% rename from icons_dev/pangolin.png rename to moth/icons_dev/pangolin.png diff --git a/icons_dev/pc.png b/moth/icons_dev/pc.png similarity index 100% rename from icons_dev/pc.png rename to moth/icons_dev/pc.png diff --git a/icons_dev/phone.png b/moth/icons_dev/phone.png similarity index 100% rename from icons_dev/phone.png rename to moth/icons_dev/phone.png diff --git a/icons_dev/piechart.png b/moth/icons_dev/piechart.png similarity index 100% rename from icons_dev/piechart.png rename to moth/icons_dev/piechart.png diff --git a/icons_dev/pin.png b/moth/icons_dev/pin.png similarity index 100% rename from icons_dev/pin.png rename to moth/icons_dev/pin.png diff --git a/icons_dev/pizza.png b/moth/icons_dev/pizza.png similarity index 100% rename from icons_dev/pizza.png rename to moth/icons_dev/pizza.png diff --git a/icons_dev/poi.png b/moth/icons_dev/poi.png similarity index 100% rename from icons_dev/poi.png rename to moth/icons_dev/poi.png diff --git a/icons_dev/polarbear.png b/moth/icons_dev/polarbear.png similarity index 100% rename from icons_dev/polarbear.png rename to moth/icons_dev/polarbear.png diff --git a/icons_dev/quiver.png b/moth/icons_dev/quiver.png similarity index 100% rename from icons_dev/quiver.png rename to moth/icons_dev/quiver.png diff --git a/icons_dev/rabbit.png b/moth/icons_dev/rabbit.png similarity index 100% rename from icons_dev/rabbit.png rename to moth/icons_dev/rabbit.png diff --git a/icons_dev/raft.png b/moth/icons_dev/raft.png similarity index 100% rename from icons_dev/raft.png rename to moth/icons_dev/raft.png diff --git a/icons_dev/random.png b/moth/icons_dev/random.png similarity index 100% rename from icons_dev/random.png rename to moth/icons_dev/random.png diff --git a/icons_dev/rat.png b/moth/icons_dev/rat.png similarity index 100% rename from icons_dev/rat.png rename to moth/icons_dev/rat.png diff --git a/icons_dev/rattlesnake.png b/moth/icons_dev/rattlesnake.png similarity index 100% rename from icons_dev/rattlesnake.png rename to moth/icons_dev/rattlesnake.png diff --git a/icons_dev/resize.png b/moth/icons_dev/resize.png similarity index 100% rename from icons_dev/resize.png rename to moth/icons_dev/resize.png diff --git a/icons_dev/revolver.png b/moth/icons_dev/revolver.png similarity index 100% rename from icons_dev/revolver.png rename to moth/icons_dev/revolver.png diff --git a/icons_dev/ring.png b/moth/icons_dev/ring.png similarity index 100% rename from icons_dev/ring.png rename to moth/icons_dev/ring.png diff --git a/icons_dev/rooster.png b/moth/icons_dev/rooster.png similarity index 100% rename from icons_dev/rooster.png rename to moth/icons_dev/rooster.png diff --git a/icons_dev/rss.png b/moth/icons_dev/rss.png similarity index 100% rename from icons_dev/rss.png rename to moth/icons_dev/rss.png diff --git a/icons_dev/rupee.png b/moth/icons_dev/rupee.png similarity index 100% rename from icons_dev/rupee.png rename to moth/icons_dev/rupee.png diff --git a/icons_dev/sausage.png b/moth/icons_dev/sausage.png similarity index 100% rename from icons_dev/sausage.png rename to moth/icons_dev/sausage.png diff --git a/icons_dev/scorpion.png b/moth/icons_dev/scorpion.png similarity index 100% rename from icons_dev/scorpion.png rename to moth/icons_dev/scorpion.png diff --git a/icons_dev/screw.png b/moth/icons_dev/screw.png similarity index 100% rename from icons_dev/screw.png rename to moth/icons_dev/screw.png diff --git a/icons_dev/shamrock.png b/moth/icons_dev/shamrock.png similarity index 100% rename from icons_dev/shamrock.png rename to moth/icons_dev/shamrock.png diff --git a/icons_dev/sheep.png b/moth/icons_dev/sheep.png similarity index 100% rename from icons_dev/sheep.png rename to moth/icons_dev/sheep.png diff --git a/icons_dev/shirt.png b/moth/icons_dev/shirt.png similarity index 100% rename from icons_dev/shirt.png rename to moth/icons_dev/shirt.png diff --git a/icons_dev/shop.png b/moth/icons_dev/shop.png similarity index 100% rename from icons_dev/shop.png rename to moth/icons_dev/shop.png diff --git a/icons_dev/shuriken.png b/moth/icons_dev/shuriken.png similarity index 100% rename from icons_dev/shuriken.png rename to moth/icons_dev/shuriken.png diff --git a/icons_dev/sloth.png b/moth/icons_dev/sloth.png similarity index 100% rename from icons_dev/sloth.png rename to moth/icons_dev/sloth.png diff --git a/icons_dev/snail.png b/moth/icons_dev/snail.png similarity index 100% rename from icons_dev/snail.png rename to moth/icons_dev/snail.png diff --git a/icons_dev/snake.png b/moth/icons_dev/snake.png similarity index 100% rename from icons_dev/snake.png rename to moth/icons_dev/snake.png diff --git a/icons_dev/soap.png b/moth/icons_dev/soap.png similarity index 100% rename from icons_dev/soap.png rename to moth/icons_dev/soap.png diff --git a/icons_dev/sombrero.png b/moth/icons_dev/sombrero.png similarity index 100% rename from icons_dev/sombrero.png rename to moth/icons_dev/sombrero.png diff --git a/icons_dev/stairs.png b/moth/icons_dev/stairs.png similarity index 100% rename from icons_dev/stairs.png rename to moth/icons_dev/stairs.png diff --git a/icons_dev/steak.png b/moth/icons_dev/steak.png similarity index 100% rename from icons_dev/steak.png rename to moth/icons_dev/steak.png diff --git a/icons_dev/tomato.png b/moth/icons_dev/tomato.png similarity index 100% rename from icons_dev/tomato.png rename to moth/icons_dev/tomato.png diff --git a/icons_dev/trade.png b/moth/icons_dev/trade.png similarity index 100% rename from icons_dev/trade.png rename to moth/icons_dev/trade.png diff --git a/icons_dev/trombone.png b/moth/icons_dev/trombone.png similarity index 100% rename from icons_dev/trombone.png rename to moth/icons_dev/trombone.png diff --git a/icons_dev/trousers.png b/moth/icons_dev/trousers.png similarity index 100% rename from icons_dev/trousers.png rename to moth/icons_dev/trousers.png diff --git a/icons_dev/trumpet.png b/moth/icons_dev/trumpet.png similarity index 100% rename from icons_dev/trumpet.png rename to moth/icons_dev/trumpet.png diff --git a/icons_dev/tuba.png b/moth/icons_dev/tuba.png similarity index 100% rename from icons_dev/tuba.png rename to moth/icons_dev/tuba.png diff --git a/icons_dev/tv.png b/moth/icons_dev/tv.png similarity index 100% rename from icons_dev/tv.png rename to moth/icons_dev/tv.png diff --git a/icons_dev/ufo.png b/moth/icons_dev/ufo.png similarity index 100% rename from icons_dev/ufo.png rename to moth/icons_dev/ufo.png diff --git a/icons_dev/vial.png b/moth/icons_dev/vial.png similarity index 100% rename from icons_dev/vial.png rename to moth/icons_dev/vial.png diff --git a/icons_dev/watch.png b/moth/icons_dev/watch.png similarity index 100% rename from icons_dev/watch.png rename to moth/icons_dev/watch.png diff --git a/icons_dev/waterfall.png b/moth/icons_dev/waterfall.png similarity index 100% rename from icons_dev/waterfall.png rename to moth/icons_dev/waterfall.png diff --git a/icons_dev/well.png b/moth/icons_dev/well.png similarity index 100% rename from icons_dev/well.png rename to moth/icons_dev/well.png diff --git a/icons_dev/windmill.png b/moth/icons_dev/windmill.png similarity index 100% rename from icons_dev/windmill.png rename to moth/icons_dev/windmill.png diff --git a/icons_dev/wizard.png b/moth/icons_dev/wizard.png similarity index 100% rename from icons_dev/wizard.png rename to moth/icons_dev/wizard.png diff --git a/icons_dev/zipper.png b/moth/icons_dev/zipper.png similarity index 100% rename from icons_dev/zipper.png rename to moth/icons_dev/zipper.png diff --git a/scripts/modules/imgui.js b/moth/imgui.js similarity index 100% rename from scripts/modules/imgui.js rename to moth/imgui.js diff --git a/scripts/modules/lcdsprite.js b/moth/lcdsprite.js similarity index 100% rename from scripts/modules/lcdsprite.js rename to moth/lcdsprite.js diff --git a/scripts/moth.js b/moth/moth.js similarity index 100% rename from scripts/moth.js rename to moth/moth.js diff --git a/scripts/nogame/config.js b/moth/nogame/config.js similarity index 100% rename from scripts/nogame/config.js rename to moth/nogame/config.js diff --git a/scripts/nogame/main.js b/moth/nogame/main.js similarity index 100% rename from scripts/nogame/main.js rename to moth/nogame/main.js diff --git a/scripts/modules/rasterize.js b/moth/rasterize.js similarity index 100% rename from scripts/modules/rasterize.js rename to moth/rasterize.js diff --git a/scripts/modules/scenetree.js b/moth/scenetree.js similarity index 100% rename from scripts/modules/scenetree.js rename to moth/scenetree.js diff --git a/scripts/modules/sdl_gpu.js b/moth/sdl_gpu.js similarity index 100% rename from scripts/modules/sdl_gpu.js rename to moth/sdl_gpu.js diff --git a/shaders/circle.frag.hlsl b/moth/shaders/circle.frag.hlsl similarity index 100% rename from shaders/circle.frag.hlsl rename to moth/shaders/circle.frag.hlsl diff --git a/shaders/common/common.hlsl b/moth/shaders/common/common.hlsl similarity index 100% rename from shaders/common/common.hlsl rename to moth/shaders/common/common.hlsl diff --git a/shaders/common/model_pixel.hlsl b/moth/shaders/common/model_pixel.hlsl similarity index 100% rename from shaders/common/model_pixel.hlsl rename to moth/shaders/common/model_pixel.hlsl diff --git a/shaders/common/model_vertex.hlsl b/moth/shaders/common/model_vertex.hlsl similarity index 100% rename from shaders/common/model_vertex.hlsl rename to moth/shaders/common/model_vertex.hlsl diff --git a/shaders/common/pixel.hlsl b/moth/shaders/common/pixel.hlsl similarity index 100% rename from shaders/common/pixel.hlsl rename to moth/shaders/common/pixel.hlsl diff --git a/shaders/common/sdf.hlsl b/moth/shaders/common/sdf.hlsl similarity index 100% rename from shaders/common/sdf.hlsl rename to moth/shaders/common/sdf.hlsl diff --git a/shaders/common/vertex.hlsl b/moth/shaders/common/vertex.hlsl similarity index 100% rename from shaders/common/vertex.hlsl rename to moth/shaders/common/vertex.hlsl diff --git a/shaders/compile.sh b/moth/shaders/compile.sh similarity index 100% rename from shaders/compile.sh rename to moth/shaders/compile.sh diff --git a/shaders/dbgline.frag.hlsl b/moth/shaders/dbgline.frag.hlsl similarity index 100% rename from shaders/dbgline.frag.hlsl rename to moth/shaders/dbgline.frag.hlsl diff --git a/shaders/dbgline.vert.hlsl b/moth/shaders/dbgline.vert.hlsl similarity index 100% rename from shaders/dbgline.vert.hlsl rename to moth/shaders/dbgline.vert.hlsl diff --git a/shaders/dxil/dbgline.frag.dxil b/moth/shaders/dxil/dbgline.frag.dxil similarity index 100% rename from shaders/dxil/dbgline.frag.dxil rename to moth/shaders/dxil/dbgline.frag.dxil diff --git a/shaders/dxil/dbgline.vert.dxil b/moth/shaders/dxil/dbgline.vert.dxil similarity index 100% rename from shaders/dxil/dbgline.vert.dxil rename to moth/shaders/dxil/dbgline.vert.dxil diff --git a/shaders/dxil/model.frag.dxil b/moth/shaders/dxil/model.frag.dxil similarity index 100% rename from shaders/dxil/model.frag.dxil rename to moth/shaders/dxil/model.frag.dxil diff --git a/shaders/dxil/model.vert.dxil b/moth/shaders/dxil/model.vert.dxil similarity index 100% rename from shaders/dxil/model.vert.dxil rename to moth/shaders/dxil/model.vert.dxil diff --git a/shaders/dxil/model_lit.frag.dxil b/moth/shaders/dxil/model_lit.frag.dxil similarity index 100% rename from shaders/dxil/model_lit.frag.dxil rename to moth/shaders/dxil/model_lit.frag.dxil diff --git a/shaders/dxil/post.frag.dxil b/moth/shaders/dxil/post.frag.dxil similarity index 100% rename from shaders/dxil/post.frag.dxil rename to moth/shaders/dxil/post.frag.dxil diff --git a/shaders/dxil/post.vert.dxil b/moth/shaders/dxil/post.vert.dxil similarity index 100% rename from shaders/dxil/post.vert.dxil rename to moth/shaders/dxil/post.vert.dxil diff --git a/shaders/dxil/ps1.frag.dxil b/moth/shaders/dxil/ps1.frag.dxil similarity index 100% rename from shaders/dxil/ps1.frag.dxil rename to moth/shaders/dxil/ps1.frag.dxil diff --git a/shaders/dxil/ps1.vert.dxil b/moth/shaders/dxil/ps1.vert.dxil similarity index 100% rename from shaders/dxil/ps1.vert.dxil rename to moth/shaders/dxil/ps1.vert.dxil diff --git a/shaders/dxil/rectangle.frag.dxil b/moth/shaders/dxil/rectangle.frag.dxil similarity index 100% rename from shaders/dxil/rectangle.frag.dxil rename to moth/shaders/dxil/rectangle.frag.dxil diff --git a/shaders/dxil/sprite.frag.dxil b/moth/shaders/dxil/sprite.frag.dxil similarity index 100% rename from shaders/dxil/sprite.frag.dxil rename to moth/shaders/dxil/sprite.frag.dxil diff --git a/shaders/dxil/sprite.vert.dxil b/moth/shaders/dxil/sprite.vert.dxil similarity index 100% rename from shaders/dxil/sprite.vert.dxil rename to moth/shaders/dxil/sprite.vert.dxil diff --git a/shaders/model.frag.hlsl b/moth/shaders/model.frag.hlsl similarity index 100% rename from shaders/model.frag.hlsl rename to moth/shaders/model.frag.hlsl diff --git a/shaders/model.vert.hlsl b/moth/shaders/model.vert.hlsl similarity index 100% rename from shaders/model.vert.hlsl rename to moth/shaders/model.vert.hlsl diff --git a/shaders/model_lit.frag.hlsl b/moth/shaders/model_lit.frag.hlsl similarity index 100% rename from shaders/model_lit.frag.hlsl rename to moth/shaders/model_lit.frag.hlsl diff --git a/shaders/msl/dbgline.frag.msl b/moth/shaders/msl/dbgline.frag.msl similarity index 100% rename from shaders/msl/dbgline.frag.msl rename to moth/shaders/msl/dbgline.frag.msl diff --git a/shaders/msl/dbgline.vert.msl b/moth/shaders/msl/dbgline.vert.msl similarity index 100% rename from shaders/msl/dbgline.vert.msl rename to moth/shaders/msl/dbgline.vert.msl diff --git a/shaders/msl/model.frag.msl b/moth/shaders/msl/model.frag.msl similarity index 100% rename from shaders/msl/model.frag.msl rename to moth/shaders/msl/model.frag.msl diff --git a/shaders/msl/model.vert.msl b/moth/shaders/msl/model.vert.msl similarity index 100% rename from shaders/msl/model.vert.msl rename to moth/shaders/msl/model.vert.msl diff --git a/shaders/msl/model_lit.frag.msl b/moth/shaders/msl/model_lit.frag.msl similarity index 100% rename from shaders/msl/model_lit.frag.msl rename to moth/shaders/msl/model_lit.frag.msl diff --git a/shaders/msl/post.frag.msl b/moth/shaders/msl/post.frag.msl similarity index 100% rename from shaders/msl/post.frag.msl rename to moth/shaders/msl/post.frag.msl diff --git a/shaders/msl/post.vert.msl b/moth/shaders/msl/post.vert.msl similarity index 100% rename from shaders/msl/post.vert.msl rename to moth/shaders/msl/post.vert.msl diff --git a/shaders/msl/ps1.frag.msl b/moth/shaders/msl/ps1.frag.msl similarity index 100% rename from shaders/msl/ps1.frag.msl rename to moth/shaders/msl/ps1.frag.msl diff --git a/shaders/msl/ps1.vert.msl b/moth/shaders/msl/ps1.vert.msl similarity index 100% rename from shaders/msl/ps1.vert.msl rename to moth/shaders/msl/ps1.vert.msl diff --git a/shaders/msl/rectangle.frag.msl b/moth/shaders/msl/rectangle.frag.msl similarity index 100% rename from shaders/msl/rectangle.frag.msl rename to moth/shaders/msl/rectangle.frag.msl diff --git a/shaders/msl/sprite.frag.msl b/moth/shaders/msl/sprite.frag.msl similarity index 100% rename from shaders/msl/sprite.frag.msl rename to moth/shaders/msl/sprite.frag.msl diff --git a/shaders/msl/sprite.vert.msl b/moth/shaders/msl/sprite.vert.msl similarity index 100% rename from shaders/msl/sprite.vert.msl rename to moth/shaders/msl/sprite.vert.msl diff --git a/shaders/post.frag.hlsl b/moth/shaders/post.frag.hlsl similarity index 100% rename from shaders/post.frag.hlsl rename to moth/shaders/post.frag.hlsl diff --git a/shaders/post.vert.hlsl b/moth/shaders/post.vert.hlsl similarity index 100% rename from shaders/post.vert.hlsl rename to moth/shaders/post.vert.hlsl diff --git a/shaders/ps1.frag.hlsl b/moth/shaders/ps1.frag.hlsl similarity index 100% rename from shaders/ps1.frag.hlsl rename to moth/shaders/ps1.frag.hlsl diff --git a/shaders/ps1.vert.hlsl b/moth/shaders/ps1.vert.hlsl similarity index 100% rename from shaders/ps1.vert.hlsl rename to moth/shaders/ps1.vert.hlsl diff --git a/shaders/rectangle.frag.hlsl b/moth/shaders/rectangle.frag.hlsl similarity index 100% rename from shaders/rectangle.frag.hlsl rename to moth/shaders/rectangle.frag.hlsl diff --git a/shaders/reflection/dbgline.frag.json b/moth/shaders/reflection/dbgline.frag.json similarity index 100% rename from shaders/reflection/dbgline.frag.json rename to moth/shaders/reflection/dbgline.frag.json diff --git a/shaders/reflection/dbgline.vert.json b/moth/shaders/reflection/dbgline.vert.json similarity index 100% rename from shaders/reflection/dbgline.vert.json rename to moth/shaders/reflection/dbgline.vert.json diff --git a/shaders/reflection/model.frag.json b/moth/shaders/reflection/model.frag.json similarity index 100% rename from shaders/reflection/model.frag.json rename to moth/shaders/reflection/model.frag.json diff --git a/shaders/reflection/model.vert.json b/moth/shaders/reflection/model.vert.json similarity index 100% rename from shaders/reflection/model.vert.json rename to moth/shaders/reflection/model.vert.json diff --git a/shaders/reflection/model_lit.frag.json b/moth/shaders/reflection/model_lit.frag.json similarity index 100% rename from shaders/reflection/model_lit.frag.json rename to moth/shaders/reflection/model_lit.frag.json diff --git a/shaders/reflection/post.frag.json b/moth/shaders/reflection/post.frag.json similarity index 100% rename from shaders/reflection/post.frag.json rename to moth/shaders/reflection/post.frag.json diff --git a/shaders/reflection/post.vert.json b/moth/shaders/reflection/post.vert.json similarity index 100% rename from shaders/reflection/post.vert.json rename to moth/shaders/reflection/post.vert.json diff --git a/shaders/reflection/ps1.frag.json b/moth/shaders/reflection/ps1.frag.json similarity index 100% rename from shaders/reflection/ps1.frag.json rename to moth/shaders/reflection/ps1.frag.json diff --git a/shaders/reflection/ps1.vert.json b/moth/shaders/reflection/ps1.vert.json similarity index 100% rename from shaders/reflection/ps1.vert.json rename to moth/shaders/reflection/ps1.vert.json diff --git a/shaders/reflection/rectangle.frag.json b/moth/shaders/reflection/rectangle.frag.json similarity index 100% rename from shaders/reflection/rectangle.frag.json rename to moth/shaders/reflection/rectangle.frag.json diff --git a/shaders/reflection/sprite.frag.json b/moth/shaders/reflection/sprite.frag.json similarity index 100% rename from shaders/reflection/sprite.frag.json rename to moth/shaders/reflection/sprite.frag.json diff --git a/shaders/reflection/sprite.vert.json b/moth/shaders/reflection/sprite.vert.json similarity index 100% rename from shaders/reflection/sprite.vert.json rename to moth/shaders/reflection/sprite.vert.json diff --git a/shaders/sprite.frag.hlsl b/moth/shaders/sprite.frag.hlsl similarity index 100% rename from shaders/sprite.frag.hlsl rename to moth/shaders/sprite.frag.hlsl diff --git a/shaders/sprite.vert.hlsl b/moth/shaders/sprite.vert.hlsl similarity index 100% rename from shaders/sprite.vert.hlsl rename to moth/shaders/sprite.vert.hlsl diff --git a/shaders/spv/dbgline.frag.spv b/moth/shaders/spv/dbgline.frag.spv similarity index 100% rename from shaders/spv/dbgline.frag.spv rename to moth/shaders/spv/dbgline.frag.spv diff --git a/shaders/spv/dbgline.vert.spv b/moth/shaders/spv/dbgline.vert.spv similarity index 100% rename from shaders/spv/dbgline.vert.spv rename to moth/shaders/spv/dbgline.vert.spv diff --git a/shaders/spv/model.frag.spv b/moth/shaders/spv/model.frag.spv similarity index 100% rename from shaders/spv/model.frag.spv rename to moth/shaders/spv/model.frag.spv diff --git a/shaders/spv/model.vert.spv b/moth/shaders/spv/model.vert.spv similarity index 100% rename from shaders/spv/model.vert.spv rename to moth/shaders/spv/model.vert.spv diff --git a/shaders/spv/model_lit.frag.spv b/moth/shaders/spv/model_lit.frag.spv similarity index 100% rename from shaders/spv/model_lit.frag.spv rename to moth/shaders/spv/model_lit.frag.spv diff --git a/shaders/spv/post.frag.spv b/moth/shaders/spv/post.frag.spv similarity index 100% rename from shaders/spv/post.frag.spv rename to moth/shaders/spv/post.frag.spv diff --git a/shaders/spv/post.vert.spv b/moth/shaders/spv/post.vert.spv similarity index 100% rename from shaders/spv/post.vert.spv rename to moth/shaders/spv/post.vert.spv diff --git a/shaders/spv/ps1.frag.spv b/moth/shaders/spv/ps1.frag.spv similarity index 100% rename from shaders/spv/ps1.frag.spv rename to moth/shaders/spv/ps1.frag.spv diff --git a/shaders/spv/ps1.vert.spv b/moth/shaders/spv/ps1.vert.spv similarity index 100% rename from shaders/spv/ps1.vert.spv rename to moth/shaders/spv/ps1.vert.spv diff --git a/shaders/spv/rectangle.frag.spv b/moth/shaders/spv/rectangle.frag.spv similarity index 100% rename from shaders/spv/rectangle.frag.spv rename to moth/shaders/spv/rectangle.frag.spv diff --git a/shaders/spv/sprite.frag.spv b/moth/shaders/spv/sprite.frag.spv similarity index 100% rename from shaders/spv/sprite.frag.spv rename to moth/shaders/spv/sprite.frag.spv diff --git a/shaders/spv/sprite.vert.spv b/moth/shaders/spv/sprite.vert.spv similarity index 100% rename from shaders/spv/sprite.vert.spv rename to moth/shaders/spv/sprite.vert.spv diff --git a/shaders/wind.hlsl b/moth/shaders/wind.hlsl similarity index 100% rename from shaders/wind.hlsl rename to moth/shaders/wind.hlsl diff --git a/scripts/modules/sound.js b/moth/sound.js similarity index 100% rename from scripts/modules/sound.js rename to moth/sound.js diff --git a/scripts/modules/spline.js b/moth/spline.js similarity index 100% rename from scripts/modules/spline.js rename to moth/spline.js diff --git a/scripts/modules/ext/sprite.js b/moth/sprite.js similarity index 100% rename from scripts/modules/ext/sprite.js rename to moth/sprite.js diff --git a/tests/animation.js b/moth/tests/animation.js similarity index 100% rename from tests/animation.js rename to moth/tests/animation.js diff --git a/tests/bunny.png b/moth/tests/bunny.png similarity index 100% rename from tests/bunny.png rename to moth/tests/bunny.png diff --git a/tests/bunnymark.js b/moth/tests/bunnymark.js similarity index 100% rename from tests/bunnymark.js rename to moth/tests/bunnymark.js diff --git a/tests/camera.js b/moth/tests/camera.js similarity index 100% rename from tests/camera.js rename to moth/tests/camera.js diff --git a/tests/camera_colorspace.js b/moth/tests/camera_colorspace.js similarity index 100% rename from tests/camera_colorspace.js rename to moth/tests/camera_colorspace.js diff --git a/tests/camera_colorspace_convert.js b/moth/tests/camera_colorspace_convert.js similarity index 100% rename from tests/camera_colorspace_convert.js rename to moth/tests/camera_colorspace_convert.js diff --git a/tests/camera_info.js b/moth/tests/camera_info.js similarity index 100% rename from tests/camera_info.js rename to moth/tests/camera_info.js diff --git a/tests/crab.gif b/moth/tests/crab.gif similarity index 100% rename from tests/crab.gif rename to moth/tests/crab.gif diff --git a/tests/draw2d.js b/moth/tests/draw2d.js similarity index 100% rename from tests/draw2d.js rename to moth/tests/draw2d.js diff --git a/tests/prosperon.js b/moth/tests/prosperon.js similarity index 100% rename from tests/prosperon.js rename to moth/tests/prosperon.js diff --git a/tests/steam.js b/moth/tests/steam.js similarity index 100% rename from tests/steam.js rename to moth/tests/steam.js diff --git a/tests/surface.js b/moth/tests/surface.js similarity index 100% rename from tests/surface.js rename to moth/tests/surface.js diff --git a/tests/surface_colorspace.js b/moth/tests/surface_colorspace.js similarity index 100% rename from tests/surface_colorspace.js rename to moth/tests/surface_colorspace.js diff --git a/tests/warrior.aseprite b/moth/tests/warrior.aseprite similarity index 100% rename from tests/warrior.aseprite rename to moth/tests/warrior.aseprite diff --git a/tests/webcam.js b/moth/tests/webcam.js similarity index 100% rename from tests/webcam.js rename to moth/tests/webcam.js diff --git a/tests/window.js b/moth/tests/window.js similarity index 100% rename from tests/window.js rename to moth/tests/window.js diff --git a/scripts/modules/tween.js b/moth/tween.js similarity index 100% rename from scripts/modules/tween.js rename to moth/tween.js diff --git a/scripts/modules/video.js b/moth/video.js similarity index 100% rename from scripts/modules/video.js rename to moth/video.js diff --git a/scripts/core/base.js b/scripts/base.js similarity index 100% rename from scripts/core/base.js rename to scripts/base.js diff --git a/scripts/modules/cmd.js b/scripts/cmd.js similarity index 100% rename from scripts/modules/cmd.js rename to scripts/cmd.js diff --git a/scripts/modules/debug.js b/scripts/debug.js similarity index 100% rename from scripts/modules/debug.js rename to scripts/debug.js diff --git a/scripts/modules/dmon.js b/scripts/dmon.js similarity index 100% rename from scripts/modules/dmon.js rename to scripts/dmon.js diff --git a/scripts/modules/doc.js b/scripts/doc.js similarity index 100% rename from scripts/modules/doc.js rename to scripts/doc.js diff --git a/scripts/core/doc.js b/scripts/docstrings.js similarity index 100% rename from scripts/core/doc.js rename to scripts/docstrings.js diff --git a/scripts/modules/enet.js b/scripts/enet.js similarity index 100% rename from scripts/modules/enet.js rename to scripts/enet.js diff --git a/scripts/core/engine.js b/scripts/engine.js similarity index 94% rename from scripts/core/engine.js rename to scripts/engine.js index 67e0e2bf..9dcf10ce 100644 --- a/scripts/core/engine.js +++ b/scripts/engine.js @@ -90,7 +90,9 @@ var js = use_embed('js') var io = use_embed('io') -var RESPATH = 'scripts/modules/resources.js' +io.mount("scripts") + +var RESPATH = 'scripts/resources.js' var canonical = io.realdir(RESPATH) + 'resources.js' var content = io.slurp(RESPATH) var resources = js.eval(RESPATH, `(function setup_resources(io){${content}})`).call({}, io) @@ -111,14 +113,9 @@ function print_api(obj) { } } -prosperon.PATH = [ - "/", - "scripts/modules/" -] - var res_cache = {} -var BASEPATH = 'scripts/core/base.js' +var BASEPATH = 'scripts/base.js' var script = io.slurp(BASEPATH) var fnname = "base" script = `(function ${fnname}() { ${script}; })` @@ -184,18 +181,50 @@ globalThis.use = function use(file, ...args) { inProgress[path] = true loadingStack.push(file) - // Load and execute the script - var script = io.slurp(path) + // Determine the compiled file path in .prosperon directory + var compiledPath = path + '.o' + + // Ensure .prosperon directory exists + if (!io.exists('.prosperon')) { + io.mkdir('.prosperon') + } + + // Check if compiled version exists and is newer than source + var useCompiled = false + if (io.exists(compiledPath)) { + var srcStat = io.stat(path) + var compiledStat = io.stat(compiledPath) + if (compiledStat.modtime >= srcStat.modtime) { + useCompiled = true + } + } + + var fn var mod_name = path.name() + if (useCompiled) { + // Load compiled bytecode + var compiledBlob = io.slurpbytes(compiledPath) + fn = js.compile_unblob(compiledBlob) + fn = js.eval_compile(fn) + } else { + // Compile from source + var script = io.slurp(path) + var mod_script = `(function setup_${mod_name}_module(arg){${script};})` + fn = js.compile(path, mod_script) + + // Save compiled version to .prosperon directory + var compiled = js.compile_blob(fn) + io.slurpwrite(compiledPath, compiled) + + fn = js.eval_compile(fn) + } + // Create context - if embedded module exists, script extends it var context = {} if (embed_mod) context.__proto__ = embed_mod - var mod_script = `(function setup_${mod_name}_module(arg){${script};})` - var fn = js.eval(path, mod_script) - // Call the script - pass embedded module as 'this' if it exists var ret = fn.call(context, args) @@ -250,7 +279,7 @@ stone.p = function(object) return Object.isFrozen(object) } -var DOCPATH = 'scripts/core/doc.js' +var DOCPATH = 'scripts/doc.js' var script = io.slurp(DOCPATH) var fnname = "doc" script = `(function ${fnname}() { ${script}; })` diff --git a/scripts/modules/event.js b/scripts/event.js similarity index 100% rename from scripts/modules/event.js rename to scripts/event.js diff --git a/scripts/modules/http.js b/scripts/http.js similarity index 100% rename from scripts/modules/http.js rename to scripts/http.js diff --git a/scripts/modules/io.js b/scripts/io.js similarity index 100% rename from scripts/modules/io.js rename to scripts/io.js diff --git a/scripts/modules/js.js b/scripts/js.js similarity index 100% rename from scripts/modules/js.js rename to scripts/js.js diff --git a/scripts/modules/json.js b/scripts/json.js similarity index 100% rename from scripts/modules/json.js rename to scripts/json.js diff --git a/scripts/modules/math.js b/scripts/math.js similarity index 100% rename from scripts/modules/math.js rename to scripts/math.js diff --git a/scripts/modules/miniz.js b/scripts/miniz.js similarity index 100% rename from scripts/modules/miniz.js rename to scripts/miniz.js diff --git a/scripts/modules/camera.js b/scripts/modules/camera.js deleted file mode 100644 index e8311990..00000000 --- a/scripts/modules/camera.js +++ /dev/null @@ -1,26 +0,0 @@ -var camera = this - -camera.list[prosperon.DOC] = `Return an array of available camera device IDs. - -:return: An array of camera IDs, or undefined if no cameras are available. -` - -camera.open[prosperon.DOC] = `Open a camera device with the given ID. - -:param id: The camera ID to open. -:return: A camera object on success, or throws an error if the camera cannot be opened. -` - -camera.name[prosperon.DOC] = `Return the name of the camera with the given ID. - -:param id: The camera ID to query. -:return: A string with the camera's name, or throws an error if the name cannot be retrieved. -` - -camera.position[prosperon.DOC] = `Return the physical position of the camera with the given ID. - -:param id: The camera ID to query. -:return: A string indicating the camera position ("unknown", "front", or "back"). -` - -return this; diff --git a/scripts/modules/nota.js b/scripts/nota.js similarity index 100% rename from scripts/modules/nota.js rename to scripts/nota.js diff --git a/scripts/modules/os.js b/scripts/os.js similarity index 100% rename from scripts/modules/os.js rename to scripts/os.js diff --git a/scripts/modules/parseq.js b/scripts/parseq.js similarity index 100% rename from scripts/modules/parseq.js rename to scripts/parseq.js diff --git a/scripts/modules/resources.js b/scripts/resources.js similarity index 88% rename from scripts/modules/resources.js rename to scripts/resources.js index c3f056bc..a1b43d57 100644 --- a/scripts/modules/resources.js +++ b/scripts/resources.js @@ -42,25 +42,21 @@ function find_in_path(filename, exts = []) { if (typeof filename !== 'string') return undefined if (filename.includes('.')) { - for (var dir of prosperon.PATH) { - var candidate = dir + filename - if (io.exists(candidate) && !io.is_directory(candidate)) return candidate - } + var candidate = filename // possibly need "/" ? + if (io.exists(candidate) && !io.is_directory(candidate)) return candidate return undefined } - for (var dir of prosperon.PATH) { - // Only check extensions if exts is provided and not empty - if (exts.length > 0) { - for (var ext of exts) { - var candidate = dir + filename + '.' + ext - if (io.exists(candidate) && !io.is_directory(candidate)) return candidate - } - } else { - // Fallback to extensionless file only if no extensions are specified - var candidate = dir + filename + // Only check extensions if exts is provided and not empty + if (exts.length > 0) { + for (var ext of exts) { + var candidate = filename + '.' + ext if (io.exists(candidate) && !io.is_directory(candidate)) return candidate } + } else { + // Fallback to extensionless file only if no extensions are specified + var candidate = filename + if (io.exists(candidate) && !io.is_directory(candidate)) return candidate } return undefined } diff --git a/scripts/modules/time.js b/scripts/time.js similarity index 100% rename from scripts/modules/time.js rename to scripts/time.js diff --git a/scripts/modules/util.js b/scripts/util.js similarity index 100% rename from scripts/modules/util.js rename to scripts/util.js diff --git a/scripts/modules/wota.js b/scripts/wota.js similarity index 100% rename from scripts/modules/wota.js rename to scripts/wota.js diff --git a/source/jsffi.c b/source/jsffi.c index 0b8fe103..82ad5c7a 100644 --- a/source/jsffi.c +++ b/source/jsffi.c @@ -1533,6 +1533,8 @@ void ffi_load(JSContext *js) { prosperon_rt *rt = JS_GetContextOpaque(js); + JS_FreeValue(js, js_blob_use(js)); // juice blob + m_seedRand(&rt->mrand, time(NULL)); // cell modules @@ -1588,8 +1590,6 @@ void ffi_load(JSContext *js) QJSCLASSPREP_FUNCS(font); QJSCLASSPREP_FUNCS(datastream); - // use_dyn and use_embed moved to hidden_fn - JSValue jsobject = JS_GetPropertyStr(js,globalThis, "Object"); JS_SetPropertyStr(js, jsobject, "id", JS_NewCFunction(js, js_os_value_id, "id", 1)); JS_FreeValue(js,jsobject); diff --git a/source/prosperon.c b/source/prosperon.c index d4e8b4bb..c856e01e 100644 --- a/source/prosperon.c +++ b/source/prosperon.c @@ -40,7 +40,7 @@ int tracy_profiling_enabled = 0; -#define ENGINE "scripts/core/engine.js" +#define ENGINE "scripts/engine.js" static prosperon_rt **ready_queue = NULL; static prosperon_rt **main_ready_queue = NULL; @@ -659,6 +659,7 @@ void script_startup(prosperon_rt *prt, void (*hook)(JSContext*)) #else rt = JS_NewRuntime(); #endif + JSContext *js = JS_NewContextRaw(rt); #ifdef TRACY_ENABLE diff --git a/source/qjs_blob.h b/source/qjs_blob.h index 788a0c3a..cd1058f9 100644 --- a/source/qjs_blob.h +++ b/source/qjs_blob.h @@ -13,5 +13,4 @@ void *js_get_blob_data(JSContext *js, size_t *size, JSValue v); int js_is_blob(JSContext *js, JSValue v); - #endif diff --git a/source/qjs_js.c b/source/qjs_js.c index 9b9d0210..7fe5dcc7 100644 --- a/source/qjs_js.c +++ b/source/qjs_js.c @@ -84,7 +84,37 @@ JSC_CCALL(os_memstate, JSC_CCALL(os_gc, JS_RunGC(JS_GetRuntime(js)) ) JSC_SSCALL(os_eval, - ret = JS_Eval(js,str2,strlen(str2),str,JS_EVAL_TYPE_GLOBAL); + ret = JS_Eval(js,str2,strlen(str2),str, JS_EVAL_FLAG_STRICT); +) + +JSC_SSCALL(js_compile, + ret = JS_Eval(js, str2, strlen(str2), str, JS_EVAL_FLAG_STRICT | JS_EVAL_FLAG_COMPILE_ONLY); +) + +JSC_CCALL(js_eval_compile, + JS_DupValue(js,argv[0]); + ret = JS_EvalFunction(js, argv[0]); +) + +#include "qjs_blob.h" + +JSC_CCALL(js_compile_blob, + JSRuntime *rt = JS_GetRuntime(js); + JS_SetStripInfo(rt, JS_STRIP_SOURCE); + JS_SetStripInfo(rt, JS_STRIP_DEBUG); + size_t size; + uint8_t *data = JS_WriteObject(js, &size, argv[0], JS_WRITE_OBJ_BYTECODE); + ret = js_new_blob_stoned_copy(js, data, size); + printf("found size to be %u\n", size); + free(data); +) + +JSC_CCAL(js_compile_unblob, + size_t size; + void *data = js_get_blob_data(js, &size, argv[0]); + if (!data) return JS_ThrowReferenceError(js, "Must be a stoned blob."); + + return JS_ReadObject(js, data, size, JS_READ_OBJ_BYTECODE); ) JSC_CCALL(os_mem_limit, JS_SetMemoryLimit(JS_GetRuntime(js), js2number(js,argv[0]))) @@ -162,6 +192,9 @@ static const JSCFunctionListEntry js_js_funcs[] = { MIST_FUNC_DEF(os, memstate, 0), MIST_FUNC_DEF(os, gc, 0), MIST_FUNC_DEF(os, eval, 2), + MIST_FUNC_DEF(js, compile, 2), + MIST_FUNC_DEF(js, eval_compile, 1), + MIST_FUNC_DEF(js, compile_blob, 1), MIST_FUNC_DEF(os, rt_info, 0), };