diff --git a/colors.ts b/data/colors.ts similarity index 100% rename from colors.ts rename to data/colors.ts diff --git a/font.ts b/data/font.ts similarity index 100% rename from font.ts rename to data/font.ts diff --git a/icons.ts b/data/icons.ts similarity index 100% rename from icons.ts rename to data/icons.ts diff --git a/initialCart.json b/data/initialCart.json similarity index 100% rename from initialCart.json rename to data/initialCart.json diff --git a/manual.md b/docs/manual.md similarity index 100% rename from manual.md rename to docs/manual.md diff --git a/pico8_builtins.txt b/docs/pico8_builtins.txt similarity index 100% rename from pico8_builtins.txt rename to docs/pico8_builtins.txt diff --git a/codetab.ts b/editor/codetab.ts similarity index 97% rename from codetab.ts rename to editor/codetab.ts index 87bfde3..9a27cc4 100644 --- a/codetab.ts +++ b/editor/codetab.ts @@ -1,13 +1,13 @@ -import { clearScreen, fillRect } from "./window.ts"; -import { CHAR, font } from "./font.ts"; -import { drawText, measureText } from "./builtins.ts"; -import { COLOR } from "./colors.ts"; -import { getCodeSheet, setSheet } from "./sheet.ts"; -import { K, ctrlKeyDown, getKeyboardString, keyPressed, shiftKeyDown } from "./keyboard.ts"; -import { clipboard, tokenize } from "./deps.ts"; -import { getBuiltins } from "./runcode.ts"; +import { clearScreen, fillRect } from "../io/window.ts"; +import { CHAR, font } from "../data/font.ts"; +import { drawText, measureText } from "../runtime/builtins.ts"; +import { COLOR } from "../data/colors.ts"; +import { getCodeSheet, setSheet } from "../io/sheet.ts"; +import { K, ctrlKeyDown, getKeyboardString, keyPressed, shiftKeyDown } from "../io/keyboard.ts"; +import { clipboard, tokenize } from "../deps.ts"; +import { getBuiltins } from "../runtime/runcode.ts"; import { page } from "./viewsheets.ts"; -import { mouseDown, mouseHeld, mousePos } from "./mouse.ts"; +import { mouseDown, mouseHeld, mousePos } from "../io/mouse.ts"; const historyDebounceFrames = 20; diff --git a/editmode.ts b/editor/editmode.ts similarity index 85% rename from editmode.ts rename to editor/editmode.ts index 5047a73..13e99b9 100644 --- a/editmode.ts +++ b/editor/editmode.ts @@ -1,13 +1,13 @@ -import { clearScreen, fillRect } from "./window.ts"; +import { clearScreen, fillRect } from "../io/window.ts"; import { codetab } from "./codetab.ts"; import { spritetab } from "./spritetab.ts"; import { viewsheets, page } from "./viewsheets.ts"; -import { COLOR } from "./colors.ts"; -import { mouseClick, mousePos } from "./mouse.ts"; -import { drawIcon } from "./builtins.ts"; -import { inRect } from "./util.ts"; -import { sheetsIcon, trashIcon } from "./icons.ts"; -import { SheetType, setSheet } from "./sheet.ts"; +import { COLOR } from "../data/colors.ts"; +import { mouseClick, mousePos } from "../io/mouse.ts"; +import { drawIcon } from "../runtime/builtins.ts"; +import { inRect } from "../util/util.ts"; +import { sheetsIcon, trashIcon } from "../data/icons.ts"; +import { SheetType, setSheet } from "../io/sheet.ts"; import { nonetab } from "./nonetab.ts"; import { maptab } from "./maptab.ts"; diff --git a/maptab.ts b/editor/maptab.ts similarity index 94% rename from maptab.ts rename to editor/maptab.ts index 03bd11c..335554b 100644 --- a/maptab.ts +++ b/editor/maptab.ts @@ -1,13 +1,11 @@ -import { clearScreen, fillRect } from "./window.ts"; -import { drawSprite, drawText } from "./builtins.ts"; -import { COLOR } from "./colors.ts"; -import { getMapSheet, getSheet, setSheet } from "./sheet.ts"; -import { M, mouseClick, mouseDown, mouseHeld, mousePos } from "./mouse.ts"; -import { drawTransparentRect, drawVoidRect, inRect, reGrid } from "./util.ts"; +import { clearScreen, fillRect } from "../io/window.ts"; +import { drawSprite, drawText, useSpritesheet } from "../runtime/builtins.ts"; +import { COLOR } from "../data/colors.ts"; +import { getMapSheet, getSheet, setSheet } from "../io/sheet.ts"; +import { M, mouseClick, mouseDown, mouseHeld, mousePos } from "../io/mouse.ts"; +import { drawTransparentRect, drawVoidRect, inRect, reGrid } from "../util/util.ts"; import { page } from "./viewsheets.ts"; -import { useSpritesheet } from "./builtins.ts"; -import { keyPressed } from "./keyboard.ts"; -import { K } from "./keyboard.ts"; +import { keyPressed, K } from "../io/keyboard.ts"; const state = { selectedSpriteSheet: 0, diff --git a/nonetab.ts b/editor/nonetab.ts similarity index 76% rename from nonetab.ts rename to editor/nonetab.ts index 3a77520..298a12c 100644 --- a/nonetab.ts +++ b/editor/nonetab.ts @@ -1,12 +1,11 @@ -import { clearScreen, fillRect } from "./window.ts"; -import { drawIcon, drawText } from "./builtins.ts"; -import { COLOR } from "./colors.ts"; -import { getSheet, setSheet } from "./sheet.ts"; -import { mouseClick, mousePos } from "./mouse.ts"; -import { reGridWithGap } from "./util.ts"; +import { clearScreen, fillRect } from "../io/window.ts"; +import { drawIcon, drawText, useSpritesheet } from "../runtime/builtins.ts"; +import { COLOR } from "../data/colors.ts"; +import { getSheet, setSheet } from "../io/sheet.ts"; +import { mouseClick, mousePos } from "../io/mouse.ts"; +import { reGridWithGap } from "../util/util.ts"; import { page } from "./viewsheets.ts"; -import { useSpritesheet } from "./builtins.ts"; -import { codeIcon, mapIcon, spriteIcon } from "./icons.ts"; +import { codeIcon, mapIcon, spriteIcon } from "../data/icons.ts"; const gridX = 8; const gridY = 40; diff --git a/spritetab.ts b/editor/spritetab.ts similarity index 92% rename from spritetab.ts rename to editor/spritetab.ts index 2af721c..13b8ab1 100644 --- a/spritetab.ts +++ b/editor/spritetab.ts @@ -1,11 +1,10 @@ -import { clearScreen, fillRect } from "./window.ts"; -import { drawSprite, drawText } from "./builtins.ts"; -import { COLOR } from "./colors.ts"; -import { getSpriteSheet, setSheet } from "./sheet.ts"; -import { mouseClick, mouseHeld, mousePos } from "./mouse.ts"; -import { drawTransparentRect, inRect, outlineRect, reGrid } from "./util.ts"; +import { clearScreen, fillRect } from "../io/window.ts"; +import { drawSprite, drawText, useSpritesheet } from "../runtime/builtins.ts"; +import { COLOR } from "../data/colors.ts"; +import { getSpriteSheet, setSheet } from "../io/sheet.ts"; +import { mouseClick, mouseHeld, mousePos } from "../io/mouse.ts"; +import { drawTransparentRect, inRect, outlineRect, reGrid } from "../util/util.ts"; import { page } from "./viewsheets.ts"; -import { useSpritesheet } from "./builtins.ts"; const state = { selectedSprite: 0, diff --git a/viewsheets.ts b/editor/viewsheets.ts similarity index 72% rename from viewsheets.ts rename to editor/viewsheets.ts index c4ec240..7b88923 100644 --- a/viewsheets.ts +++ b/editor/viewsheets.ts @@ -1,12 +1,12 @@ -import { clearScreen, fillRect } from "./window.ts"; -import { drawIcon, drawText } from "./builtins.ts"; -import { COLOR } from "./colors.ts"; -import { getSheet } from "./sheet.ts"; -import { mouseClick, mousePos } from "./mouse.ts"; -import { getCart } from "./cart.ts"; -import { font } from "./font.ts"; -import { codeIcon, spriteIcon, mapIcon } from "./icons.ts"; -import { reGridWithGap } from "./util.ts"; +import { clearScreen, fillRect } from "../io/window.ts"; +import { drawIcon, drawText } from "../runtime/builtins.ts"; +import { COLOR } from "../data/colors.ts"; +import { getSheet } from "../io/sheet.ts"; +import { mouseClick, mousePos } from "../io/mouse.ts"; +import { getCart } from "../io/cart.ts"; +import { font } from "../data/font.ts"; +import { codeIcon, spriteIcon, mapIcon } from "../data/icons.ts"; +import { reGridWithGap } from "../util/util.ts"; const fontHeight = font.height; diff --git a/index.ts b/index.ts index b8c0907..3121900 100644 --- a/index.ts +++ b/index.ts @@ -2,15 +2,15 @@ import { mainloop, frame, clearScreen, -} from "./window.ts"; -import { runCode } from "./runcode.ts"; -import { getCodeSheet } from "./sheet.ts"; -import { refreshKeyboard, keyPressed, K } from "./keyboard.ts"; -import { repl, resetRepl } from "./repl.ts"; -import { addToContext } from "./runcode.ts"; -import { editmode } from "./editmode.ts"; -import { refreshMouse } from "./mouse.ts"; -import { camera } from "./builtins.ts"; +} from "./io/window.ts"; +import { runCode } from "./runtime/runcode.ts"; +import { getCodeSheet } from "./io/sheet.ts"; +import { refreshKeyboard, keyPressed, K } from "./io/keyboard.ts"; +import { repl, resetRepl } from "./repl/repl.ts"; +import { addToContext } from "./runtime/runcode.ts"; +import { editmode } from "./editor/editmode.ts"; +import { refreshMouse } from "./io/mouse.ts"; +import { camera } from "./runtime/builtins.ts"; // deno-lint-ignore no-explicit-any let game: any = null; diff --git a/cart.ts b/io/cart.ts similarity index 86% rename from cart.ts rename to io/cart.ts index d12eab2..52970d6 100644 --- a/cart.ts +++ b/io/cart.ts @@ -1,5 +1,5 @@ -import { path } from "./deps.ts"; -import initialCart from "./initialCart.json" assert { type: "json" }; +import { path } from "../deps.ts"; +import initialCart from "../data/initialCart.json" assert { type: "json" }; import { Sheet } from "./sheet.ts"; const extension = ".faux"; diff --git a/keyboard.ts b/io/keyboard.ts similarity index 98% rename from keyboard.ts rename to io/keyboard.ts index 023d414..2b67043 100644 --- a/keyboard.ts +++ b/io/keyboard.ts @@ -1,4 +1,4 @@ -import { font, CHAR } from "./font.ts"; +import { font, CHAR } from "../data/font.ts"; const keyboard = new Map(); diff --git a/mouse.ts b/io/mouse.ts similarity index 100% rename from mouse.ts rename to io/mouse.ts diff --git a/sheet.ts b/io/sheet.ts similarity index 96% rename from sheet.ts rename to io/sheet.ts index 692ba6e..53ef42f 100644 --- a/sheet.ts +++ b/io/sheet.ts @@ -1,5 +1,5 @@ import { getCart } from "./cart.ts"; -import { LinearGrid } from "./util.ts"; +import { LinearGrid } from "../util/util.ts"; // import { runCode, addToContext } from "./runcode.ts"; // "code" | "spritesheet" | "map" | "sfx" | "patterns" | "fonts" diff --git a/window.ts b/io/window.ts similarity index 98% rename from window.ts rename to io/window.ts index c6dda74..8df9c53 100644 --- a/window.ts +++ b/io/window.ts @@ -2,9 +2,9 @@ import { createWindow, getProcAddress, gl, -} from "./deps.ts"; -export {mainloop} from "./deps.ts"; -import { COLOR, palette } from "./colors.ts"; +} from "../deps.ts"; +export {mainloop} from "../deps.ts"; +import { COLOR, palette } from "../data/colors.ts"; export const gameWindow = createWindow({ title: "Faux", diff --git a/repl.ts b/repl/repl.ts similarity index 90% rename from repl.ts rename to repl/repl.ts index 1c707a7..a75c974 100644 --- a/repl.ts +++ b/repl/repl.ts @@ -1,9 +1,9 @@ -import { drawText} from "./builtins.ts"; -import { getKeysPressed, shiftKeyDown, shiftMap, K } from "./keyboard.ts"; -import { font } from "./font.ts"; -import { addToContext, evalCode } from "./runcode.ts"; -import { clearScreen, fillRect } from "./window.ts"; -import { COLOR } from "./colors.ts"; +import { drawText} from "../runtime/builtins.ts"; +import { getKeysPressed, shiftKeyDown, shiftMap, K } from "../io/keyboard.ts"; +import { font } from "../data/font.ts"; +import { addToContext, evalCode } from "../runtime/runcode.ts"; +import { clearScreen, fillRect } from "../io/window.ts"; +import { COLOR } from "../data/colors.ts"; const lineHeight = 6; diff --git a/builtins.ts b/runtime/builtins.ts similarity index 91% rename from builtins.ts rename to runtime/builtins.ts index 2830aab..0b7cdcb 100644 --- a/builtins.ts +++ b/runtime/builtins.ts @@ -8,15 +8,15 @@ outlineCircle, fillEllipse, outlineEllipse, setPixelColor, -} from "./window.ts"; -import { CHAR, Font, font } from "./font.ts"; -import { K, keyDown, keyPressed, keyReleased } from "./keyboard.ts"; +} from "../io/window.ts"; +import { CHAR, Font, font } from "../data/font.ts"; +import { K, keyDown, keyPressed, keyReleased } from "../io/keyboard.ts"; import { addToContext, runCode } from "./runcode.ts"; -import { resetRepl } from "./repl.ts"; -import { COLOR } from "./colors.ts"; -import { getSheet, getCodeSheet, getMapSheet } from "./sheet.ts"; -import { saveCart, loadCart } from "./cart.ts"; -import { outlineRect } from "./util.ts"; +import { resetRepl } from "../repl/repl.ts"; +import { COLOR } from "../data/colors.ts"; +import { getSheet, getCodeSheet, getMapSheet } from "../io/sheet.ts"; +import { saveCart, loadCart } from "../io/cart.ts"; +import { outlineRect } from "../util/util.ts"; let spritesheet: number | null = null; diff --git a/runcode.ts b/runtime/runcode.ts similarity index 100% rename from runcode.ts rename to runtime/runcode.ts diff --git a/util.ts b/util/util.ts similarity index 96% rename from util.ts rename to util/util.ts index 1b5043a..7504c2c 100644 --- a/util.ts +++ b/util/util.ts @@ -1,5 +1,5 @@ -import { COLOR } from "./colors.ts"; -import { fillRect, setPixelColor } from "./window.ts"; +import { COLOR } from "../data/colors.ts"; +import { fillRect, setPixelColor } from "../io/window.ts"; export const inRect = (x: number, y: number, rectX: number, rectY: number, rectW: number, rectH: number) => { return (