diff --git a/bun.lock b/bun.lock index 0cb75b0..d30a370 100644 --- a/bun.lock +++ b/bun.lock @@ -54,23 +54,23 @@ "@babel/types": ["@babel/types@7.28.5", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.28.5" } }, "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA=="], - "@biomejs/biome": ["@biomejs/biome@2.3.11", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.3.11", "@biomejs/cli-darwin-x64": "2.3.11", "@biomejs/cli-linux-arm64": "2.3.11", "@biomejs/cli-linux-arm64-musl": "2.3.11", "@biomejs/cli-linux-x64": "2.3.11", "@biomejs/cli-linux-x64-musl": "2.3.11", "@biomejs/cli-win32-arm64": "2.3.11", "@biomejs/cli-win32-x64": "2.3.11" }, "bin": { "biome": "bin/biome" } }, "sha512-/zt+6qazBWguPG6+eWmiELqO+9jRsMZ/DBU3lfuU2ngtIQYzymocHhKiZRyrbra4aCOoyTg/BmY+6WH5mv9xmQ=="], + "@biomejs/biome": ["@biomejs/biome@2.3.14", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.3.14", "@biomejs/cli-darwin-x64": "2.3.14", "@biomejs/cli-linux-arm64": "2.3.14", "@biomejs/cli-linux-arm64-musl": "2.3.14", "@biomejs/cli-linux-x64": "2.3.14", "@biomejs/cli-linux-x64-musl": "2.3.14", "@biomejs/cli-win32-arm64": "2.3.14", "@biomejs/cli-win32-x64": "2.3.14" }, "bin": { "biome": "bin/biome" } }, "sha512-QMT6QviX0WqXJCaiqVMiBUCr5WRQ1iFSjvOLoTk6auKukJMvnMzWucXpwZB0e8F00/1/BsS9DzcKgWH+CLqVuA=="], - "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.3.11", "", { "os": "darwin", "cpu": "arm64" }, "sha512-/uXXkBcPKVQY7rc9Ys2CrlirBJYbpESEDme7RKiBD6MmqR2w3j0+ZZXRIL2xiaNPsIMMNhP1YnA+jRRxoOAFrA=="], + "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.3.14", "", { "os": "darwin", "cpu": "arm64" }, "sha512-UJGPpvWJMkLxSRtpCAKfKh41Q4JJXisvxZL8ChN1eNW3m/WlPFJ6EFDCE7YfUb4XS8ZFi3C1dFpxUJ0Ety5n+A=="], - "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.3.11", "", { "os": "darwin", "cpu": "x64" }, "sha512-fh7nnvbweDPm2xEmFjfmq7zSUiox88plgdHF9OIW4i99WnXrAC3o2P3ag9judoUMv8FCSUnlwJCM1B64nO5Fbg=="], + "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.3.14", "", { "os": "darwin", "cpu": "x64" }, "sha512-PNkLNQG6RLo8lG7QoWe/hhnMxJIt1tEimoXpGQjwS/dkdNiKBLPv4RpeQl8o3s1OKI3ZOR5XPiYtmbGGHAOnLA=="], - "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.3.11", "", { "os": "linux", "cpu": "arm64" }, "sha512-l4xkGa9E7Uc0/05qU2lMYfN1H+fzzkHgaJoy98wO+b/7Gl78srbCRRgwYSW+BTLixTBrM6Ede5NSBwt7rd/i6g=="], + "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.3.14", "", { "os": "linux", "cpu": "arm64" }, "sha512-KT67FKfzIw6DNnUNdYlBg+eU24Go3n75GWK6NwU4+yJmDYFe9i/MjiI+U/iEzKvo0g7G7MZqoyrhIYuND2w8QQ=="], - "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.3.11", "", { "os": "linux", "cpu": "arm64" }, "sha512-XPSQ+XIPZMLaZ6zveQdwNjbX+QdROEd1zPgMwD47zvHV+tCGB88VH+aynyGxAHdzL+Tm/+DtKST5SECs4iwCLg=="], + "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.3.14", "", { "os": "linux", "cpu": "arm64" }, "sha512-LInRbXhYujtL3sH2TMCH/UBwJZsoGwfQjBrMfl84CD4hL/41C/EU5mldqf1yoFpsI0iPWuU83U+nB2TUUypWeg=="], - "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.3.11", "", { "os": "linux", "cpu": "x64" }, "sha512-/1s9V/H3cSe0r0Mv/Z8JryF5x9ywRxywomqZVLHAoa/uN0eY7F8gEngWKNS5vbbN/BsfpCG5yeBT5ENh50Frxg=="], + "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.3.14", "", { "os": "linux", "cpu": "x64" }, "sha512-ZsZzQsl9U+wxFrGGS4f6UxREUlgHwmEfu1IrXlgNFrNnd5Th6lIJr8KmSzu/+meSa9f4rzFrbEW9LBBA6ScoMA=="], - "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.3.11", "", { "os": "linux", "cpu": "x64" }, "sha512-vU7a8wLs5C9yJ4CB8a44r12aXYb8yYgBn+WeyzbMjaCMklzCv1oXr8x+VEyWodgJt9bDmhiaW/I0RHbn7rsNmw=="], + "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.3.14", "", { "os": "linux", "cpu": "x64" }, "sha512-KQU7EkbBBuHPW3/rAcoiVmhlPtDSGOGRPv9js7qJVpYTzjQmVR+C9Rfcz+ti8YCH+zT1J52tuBybtP4IodjxZQ=="], - "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.3.11", "", { "os": "win32", "cpu": "arm64" }, "sha512-PZQ6ElCOnkYapSsysiTy0+fYX+agXPlWugh6+eQ6uPKI3vKAqNp6TnMhoM3oY2NltSB89hz59o8xIfOdyhi9Iw=="], + "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.3.14", "", { "os": "win32", "cpu": "arm64" }, "sha512-+IKYkj/pUBbnRf1G1+RlyA3LWiDgra1xpS7H2g4BuOzzRbRB+hmlw0yFsLprHhbbt7jUzbzAbAjK/Pn0FDnh1A=="], - "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.3.11", "", { "os": "win32", "cpu": "x64" }, "sha512-43VrG813EW+b5+YbDbz31uUsheX+qFKCpXeY9kfdAx+ww3naKxeVkTD9zLIWxUPfJquANMHrmW3wbe/037G0Qg=="], + "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.3.14", "", { "os": "win32", "cpu": "x64" }, "sha512-oizCjdyQ3WJEswpb3Chdngeat56rIdSYK12JI3iI11Mt5T5EXcZ7WLuowzEaFPNJ3zmOQFliMN8QY1Pi+qsfdQ=="], "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.2", "", { "os": "aix", "cpu": "ppc64" }, "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw=="], @@ -192,7 +192,7 @@ "@types/babel__traverse": ["@types/babel__traverse@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.2" } }, "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q=="], - "@types/bun": ["@types/bun@1.3.6", "", { "dependencies": { "bun-types": "1.3.6" } }, "sha512-uWCv6FO/8LcpREhenN1d1b6fcspAB+cefwD7uti8C8VffIv0Um08TKMn98FynpTiU38+y2dUO55T11NgDt8VAA=="], + "@types/bun": ["@types/bun@1.3.8", "", { "dependencies": { "bun-types": "1.3.8" } }, "sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA=="], "@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="], @@ -206,7 +206,7 @@ "browserslist": ["browserslist@4.28.1", "", { "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", "electron-to-chromium": "^1.5.263", "node-releases": "^2.0.27", "update-browserslist-db": "^1.2.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA=="], - "bun-types": ["bun-types@1.3.6", "", { "dependencies": { "@types/node": "*" } }, "sha512-OlFwHcnNV99r//9v5IIOgQ9Uk37gZqrNMCcqEaExdkVq3Avwqok1bJFmvGMCkCE0FqzdY8VMOZpfpR3lwI+CsQ=="], + "bun-types": ["bun-types@1.3.8", "", { "dependencies": { "@types/node": "*" } }, "sha512-fL99nxdOWvV4LqjmC+8Q9kW3M4QTtTR1eePs94v5ctGqU8OeceWrSUaRw3JYb7tU3FkMIAjkueehrHPPPGKi5Q=="], "caniuse-lite": ["caniuse-lite@1.0.30001763", "", {}, "sha512-mh/dGtq56uN98LlNX9qdbKnzINhX0QzhiWBFEkFfsFO4QyCvL8YegrJAazCwXIeqkIob8BlZPGM3xdnY+sgmvQ=="], @@ -264,11 +264,11 @@ "semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "seroval": ["seroval@1.3.2", "", {}, "sha512-RbcPH1n5cfwKrru7v7+zrZvjLurgHhGyso3HTyGtRivGWgYjbOmGuivCQaORNELjNONoK35nj28EoWul9sb1zQ=="], + "seroval": ["seroval@1.5.0", "", {}, "sha512-OE4cvmJ1uSPrKorFIH9/w/Qwuvi/IMcGbv5RKgcJ/zjA/IohDLU6SVaxFN9FwajbP7nsX0dQqMDes1whk3y+yw=="], - "seroval-plugins": ["seroval-plugins@1.3.3", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-16OL3NnUBw8JG1jBLUoZJsLnQq0n5Ua6aHalhJK4fMQkz1lqR7Osz1sA30trBtd9VUDc2NgkuRCn8+/pBwqZ+w=="], + "seroval-plugins": ["seroval-plugins@1.5.0", "", { "peerDependencies": { "seroval": "^1.0" } }, "sha512-EAHqADIQondwRZIdeW2I636zgsODzoBDwb3PT/+7TLDWyw1Dy/Xv7iGUIEXXav7usHDE9HVhOU61irI3EnyyHA=="], - "solid-js": ["solid-js@1.9.10", "", { "dependencies": { "csstype": "^3.1.0", "seroval": "~1.3.0", "seroval-plugins": "~1.3.0" } }, "sha512-Coz956cos/EPDlhs6+jsdTxKuJDPT7B5SVIWgABwROyxjY7Xbr8wkzD68Et+NxnV7DLJ3nJdAC2r9InuV/4Jew=="], + "solid-js": ["solid-js@1.9.11", "", { "dependencies": { "csstype": "^3.1.0", "seroval": "~1.5.0", "seroval-plugins": "~1.5.0" } }, "sha512-WEJtcc5mkh/BnHA6Yrg4whlF8g6QwpmXXRg4P2ztPmcKeHHlH4+djYecBLhSpecZY2RRECXYUwIc/C2r3yzQ4Q=="], "solid-refresh": ["solid-refresh@0.6.3", "", { "dependencies": { "@babel/generator": "^7.23.6", "@babel/helper-module-imports": "^7.22.15", "@babel/types": "^7.23.6" }, "peerDependencies": { "solid-js": "^1.3" } }, "sha512-F3aPsX6hVw9ttm5LYlth8Q15x6MlI/J3Dn+o3EQyRTtTxidepSTwAYdozt01/YA+7ObcciagGEyXIopGZzQtbA=="], diff --git a/engine/Animation.ts b/engine/Animation.ts index a614192..84b9e0d 100644 --- a/engine/Animation.ts +++ b/engine/Animation.ts @@ -1,4 +1,4 @@ -import { drawSprite, type Sprite } from "#/lib/Sprite.ts"; +import { drawSprite, type Sprite } from "./Sprite.ts"; export const spriteMap = new Map(); diff --git a/engine/Entity.ts b/engine/Entity.ts index 9da8b5c..aa0128e 100644 --- a/engine/Entity.ts +++ b/engine/Entity.ts @@ -1,5 +1,5 @@ -import type { Animation } from "#/engine/Animation.ts"; -import { createVector, type Vector } from "#/lib/Vector.ts"; +import type { Animation } from "./Animation.ts"; +import { createVector, type Vector } from "./Vector.ts"; export type Indirect = never; diff --git a/lib/Graph.ts b/engine/Graph.ts similarity index 100% rename from lib/Graph.ts rename to engine/Graph.ts diff --git a/engine/Pointer.ts b/engine/Pointer.ts index 11994b2..743df2a 100644 --- a/engine/Pointer.ts +++ b/engine/Pointer.ts @@ -1,4 +1,4 @@ -import type { Vector } from "#/lib/Vector.ts"; +import type { Vector } from "./Vector.ts"; import { viewport } from "./Viewport.ts"; export type Pointer = { diff --git a/engine/Scene.ts b/engine/Scene.ts index cbf0a34..d6199d0 100644 --- a/engine/Scene.ts +++ b/engine/Scene.ts @@ -6,9 +6,9 @@ import { entityProcessMap, type Indirect, type Process as ProcessEntity, -} from "#/engine/Entity.ts"; -import { useWithAsyncCache } from "#/lib/cache.ts"; -import { type Graph, getNeighbours } from "#/lib/Graph.ts"; +} from "./Entity.ts"; +import { type Graph, getNeighbours } from "./Graph.ts"; +import { useWithAsyncCache } from "./lib/cache.ts"; export type SceneData = { name: string; @@ -50,7 +50,7 @@ const sceneInstancesMap = new Map>>(); export const [loadScene, sceneCache] = useWithAsyncCache( async (name: string) => { - await import(`#/scenes/${name}/scene.ts`); + await import(`#/game/scenes/${name}/scene.ts`); const data = sceneDataMap.get(name)!; const entityInstanceMap = sceneEntiyMap.get(name)!; @@ -58,7 +58,7 @@ export const [loadScene, sceneCache] = useWithAsyncCache( await Promise.all( data.entities.map(async (entity: Entity) => { - await import(`#/entities/${entity.name}/entity.ts`); + await import(`#/game/entities/${entity.name}/entity.ts`); if (!entityInstanceMap.has(entity.name)) { entityInstanceMap.set(entity.name, { diff --git a/lib/Segment.ts b/engine/Segment.ts similarity index 97% rename from lib/Segment.ts rename to engine/Segment.ts index 09d27a1..a078108 100644 --- a/lib/Segment.ts +++ b/engine/Segment.ts @@ -1,4 +1,4 @@ -import { lerp } from "./lerp.ts"; +import { lerp } from "./lib/lerp.ts"; import type { Vector } from "./Vector.ts"; export type Segment = [Vector, Vector]; diff --git a/lib/Sprite.ts b/engine/Sprite.ts similarity index 95% rename from lib/Sprite.ts rename to engine/Sprite.ts index b809c5f..92521ea 100644 --- a/lib/Sprite.ts +++ b/engine/Sprite.ts @@ -1,4 +1,4 @@ -import { loadImage } from "./loadImage.ts"; +import { loadImage } from "./lib/loadImage.ts"; export type Sprite = { image: HTMLImageElement; diff --git a/lib/Vector.ts b/engine/Vector.ts similarity index 100% rename from lib/Vector.ts rename to engine/Vector.ts diff --git a/engine/Viewport.ts b/engine/Viewport.ts index 055ee42..82e09af 100644 --- a/engine/Viewport.ts +++ b/engine/Viewport.ts @@ -1,4 +1,4 @@ -import { createVector, type Vector } from "#/lib/Vector.ts"; +import { createVector, type Vector } from "./Vector.ts"; export type Viewport = { scale: number; diff --git a/dev/FileBrowser.css b/engine/dev/FileBrowser.css similarity index 100% rename from dev/FileBrowser.css rename to engine/dev/FileBrowser.css diff --git a/dev/FileBrowser.tsx b/engine/dev/FileBrowser.tsx similarity index 92% rename from dev/FileBrowser.tsx rename to engine/dev/FileBrowser.tsx index 1a81705..026bc30 100644 --- a/dev/FileBrowser.tsx +++ b/engine/dev/FileBrowser.tsx @@ -6,9 +6,9 @@ import { For, Show, } from "solid-js"; -import { FileIcon } from "#/dev/icons/File.tsx"; -import { FolderIcon } from "#/dev/icons/Folder.tsx"; -import { FolderOpenIcon } from "#/dev/icons/FolderOpen.tsx"; +import { FileIcon } from "./icons/File.tsx"; +import { FolderIcon } from "./icons/Folder.tsx"; +import { FolderOpenIcon } from "./icons/FolderOpen.tsx"; export type BrowserFile = { path: string; diff --git a/dev/GraphBrowser.css b/engine/dev/GraphBrowser.css similarity index 100% rename from dev/GraphBrowser.css rename to engine/dev/GraphBrowser.css diff --git a/dev/GraphBrowser.tsx b/engine/dev/GraphBrowser.tsx similarity index 97% rename from dev/GraphBrowser.tsx rename to engine/dev/GraphBrowser.tsx index afd8843..abc011a 100644 --- a/dev/GraphBrowser.tsx +++ b/engine/dev/GraphBrowser.tsx @@ -1,20 +1,20 @@ import "./GraphBrowser.css"; import { type Component, createSignal, onMount } from "solid-js"; -import { currentScene } from "#/engine/Scene.ts"; import { type Edge, type Graph, getNeighbours, type Node, -} from "#/lib/Graph.ts"; -import { mulberry32 } from "#/lib/mulberry32.ts"; +} from "#/engine/Graph.ts"; +import { mulberry32 } from "#/engine/lib/mulberry32.ts"; +import { currentScene } from "#/engine/Scene.ts"; import { createVector, getDistance, scale, setDistanceNormal, type Vector, -} from "#/lib/Vector.ts"; +} from "#/engine/Vector.ts"; type PhysicsPartial = { position: Vector; diff --git a/dev/ItemList.css b/engine/dev/ItemList.css similarity index 100% rename from dev/ItemList.css rename to engine/dev/ItemList.css diff --git a/dev/ItemList.tsx b/engine/dev/ItemList.tsx similarity index 93% rename from dev/ItemList.tsx rename to engine/dev/ItemList.tsx index dfcab6d..9fc2c19 100644 --- a/dev/ItemList.tsx +++ b/engine/dev/ItemList.tsx @@ -10,10 +10,10 @@ import { type Signal, Switch, } from "solid-js"; -import { ArrowNarrowDownIcon } from "#/dev/icons/ArrowNarrowDown.tsx"; -import { ArrowNarrowUpIcon } from "#/dev/icons/ArrowNarrowUp.tsx"; -import { ArrowsSortIcon } from "#/dev/icons/ArrowsSort.tsx"; -import { ChevronDownIcon } from "#/dev/icons/ChevronDown.tsx"; +import { ArrowNarrowDownIcon } from "./icons/ArrowNarrowDown.tsx"; +import { ArrowNarrowUpIcon } from "./icons/ArrowNarrowUp.tsx"; +import { ArrowsSortIcon } from "./icons/ArrowsSort.tsx"; +import { ChevronDownIcon } from "./icons/ChevronDown.tsx"; export type ListItem = { label: string; isActive: boolean }; diff --git a/dev/controls/InputField.css b/engine/dev/controls/InputField.css similarity index 100% rename from dev/controls/InputField.css rename to engine/dev/controls/InputField.css diff --git a/dev/controls/InputField.tsx b/engine/dev/controls/InputField.tsx similarity index 100% rename from dev/controls/InputField.tsx rename to engine/dev/controls/InputField.tsx diff --git a/dev/controls/RangeSlider.css b/engine/dev/controls/RangeSlider.css similarity index 100% rename from dev/controls/RangeSlider.css rename to engine/dev/controls/RangeSlider.css diff --git a/dev/controls/RangeSlider.tsx b/engine/dev/controls/RangeSlider.tsx similarity index 100% rename from dev/controls/RangeSlider.tsx rename to engine/dev/controls/RangeSlider.tsx diff --git a/dev/fetchBrowserData.ts b/engine/dev/fetchBrowserData.ts similarity index 86% rename from dev/fetchBrowserData.ts rename to engine/dev/fetchBrowserData.ts index 8550ee4..980e633 100644 --- a/dev/fetchBrowserData.ts +++ b/engine/dev/fetchBrowserData.ts @@ -1,4 +1,4 @@ -import type { BrowserFolder } from "#/dev/FileBrowser.tsx"; +import type { BrowserFolder } from "./FileBrowser.tsx"; export async function fetchBrowserData(dir: string): Promise { const indexRef: string[] = await (await fetch(`/api/${dir}`)).json(); diff --git a/dev/icons/ArrowAutofitHeight.tsx b/engine/dev/icons/ArrowAutofitHeight.tsx similarity index 100% rename from dev/icons/ArrowAutofitHeight.tsx rename to engine/dev/icons/ArrowAutofitHeight.tsx diff --git a/dev/icons/ArrowAutofitWidth.tsx b/engine/dev/icons/ArrowAutofitWidth.tsx similarity index 100% rename from dev/icons/ArrowAutofitWidth.tsx rename to engine/dev/icons/ArrowAutofitWidth.tsx diff --git a/dev/icons/ArrowNarrowDown.tsx b/engine/dev/icons/ArrowNarrowDown.tsx similarity index 100% rename from dev/icons/ArrowNarrowDown.tsx rename to engine/dev/icons/ArrowNarrowDown.tsx diff --git a/dev/icons/ArrowNarrowUp.tsx b/engine/dev/icons/ArrowNarrowUp.tsx similarity index 100% rename from dev/icons/ArrowNarrowUp.tsx rename to engine/dev/icons/ArrowNarrowUp.tsx diff --git a/dev/icons/ArrowsSort.tsx b/engine/dev/icons/ArrowsSort.tsx similarity index 100% rename from dev/icons/ArrowsSort.tsx rename to engine/dev/icons/ArrowsSort.tsx diff --git a/dev/icons/ChevronDown.tsx b/engine/dev/icons/ChevronDown.tsx similarity index 100% rename from dev/icons/ChevronDown.tsx rename to engine/dev/icons/ChevronDown.tsx diff --git a/dev/icons/File.tsx b/engine/dev/icons/File.tsx similarity index 100% rename from dev/icons/File.tsx rename to engine/dev/icons/File.tsx diff --git a/dev/icons/FileDelta.tsx b/engine/dev/icons/FileDelta.tsx similarity index 100% rename from dev/icons/FileDelta.tsx rename to engine/dev/icons/FileDelta.tsx diff --git a/dev/icons/FileMusic.tsx b/engine/dev/icons/FileMusic.tsx similarity index 100% rename from dev/icons/FileMusic.tsx rename to engine/dev/icons/FileMusic.tsx diff --git a/dev/icons/FilePencil.tsx b/engine/dev/icons/FilePencil.tsx similarity index 100% rename from dev/icons/FilePencil.tsx rename to engine/dev/icons/FilePencil.tsx diff --git a/dev/icons/FileUnknown.tsx b/engine/dev/icons/FileUnknown.tsx similarity index 100% rename from dev/icons/FileUnknown.tsx rename to engine/dev/icons/FileUnknown.tsx diff --git a/dev/icons/FloppyDisc.tsx b/engine/dev/icons/FloppyDisc.tsx similarity index 100% rename from dev/icons/FloppyDisc.tsx rename to engine/dev/icons/FloppyDisc.tsx diff --git a/dev/icons/Folder.tsx b/engine/dev/icons/Folder.tsx similarity index 100% rename from dev/icons/Folder.tsx rename to engine/dev/icons/Folder.tsx diff --git a/dev/icons/FolderOpen.tsx b/engine/dev/icons/FolderOpen.tsx similarity index 100% rename from dev/icons/FolderOpen.tsx rename to engine/dev/icons/FolderOpen.tsx diff --git a/dev/icons/Lasso.tsx b/engine/dev/icons/Lasso.tsx similarity index 100% rename from dev/icons/Lasso.tsx rename to engine/dev/icons/Lasso.tsx diff --git a/dev/icons/LassoPolygon.tsx b/engine/dev/icons/LassoPolygon.tsx similarity index 100% rename from dev/icons/LassoPolygon.tsx rename to engine/dev/icons/LassoPolygon.tsx diff --git a/dev/icons/LayoutGrid.tsx b/engine/dev/icons/LayoutGrid.tsx similarity index 100% rename from dev/icons/LayoutGrid.tsx rename to engine/dev/icons/LayoutGrid.tsx diff --git a/dev/icons/LetterX.tsx b/engine/dev/icons/LetterX.tsx similarity index 100% rename from dev/icons/LetterX.tsx rename to engine/dev/icons/LetterX.tsx diff --git a/dev/icons/LetterY.tsx b/engine/dev/icons/LetterY.tsx similarity index 100% rename from dev/icons/LetterY.tsx rename to engine/dev/icons/LetterY.tsx diff --git a/dev/icons/Pencil.tsx b/engine/dev/icons/Pencil.tsx similarity index 100% rename from dev/icons/Pencil.tsx rename to engine/dev/icons/Pencil.tsx diff --git a/dev/icons/Polygon.tsx b/engine/dev/icons/Polygon.tsx similarity index 100% rename from dev/icons/Polygon.tsx rename to engine/dev/icons/Polygon.tsx diff --git a/dev/icons/Refresh.tsx b/engine/dev/icons/Refresh.tsx similarity index 100% rename from dev/icons/Refresh.tsx rename to engine/dev/icons/Refresh.tsx diff --git a/dev/icons/RefreshAlert.tsx b/engine/dev/icons/RefreshAlert.tsx similarity index 100% rename from dev/icons/RefreshAlert.tsx rename to engine/dev/icons/RefreshAlert.tsx diff --git a/dev/icons/RefreshDot.tsx b/engine/dev/icons/RefreshDot.tsx similarity index 100% rename from dev/icons/RefreshDot.tsx rename to engine/dev/icons/RefreshDot.tsx diff --git a/dev/icons/Reload.tsx b/engine/dev/icons/Reload.tsx similarity index 100% rename from dev/icons/Reload.tsx rename to engine/dev/icons/Reload.tsx diff --git a/dev/icons/Script.tsx b/engine/dev/icons/Script.tsx similarity index 100% rename from dev/icons/Script.tsx rename to engine/dev/icons/Script.tsx diff --git a/dev/icons/StackBackward.tsx b/engine/dev/icons/StackBackward.tsx similarity index 100% rename from dev/icons/StackBackward.tsx rename to engine/dev/icons/StackBackward.tsx diff --git a/dev/icons/StackForward.tsx b/engine/dev/icons/StackForward.tsx similarity index 100% rename from dev/icons/StackForward.tsx rename to engine/dev/icons/StackForward.tsx diff --git a/dev/icons/TransformPoint.tsx b/engine/dev/icons/TransformPoint.tsx similarity index 100% rename from dev/icons/TransformPoint.tsx rename to engine/dev/icons/TransformPoint.tsx diff --git a/dev/icons/ZoomScan.tsx b/engine/dev/icons/ZoomScan.tsx similarity index 100% rename from dev/icons/ZoomScan.tsx rename to engine/dev/icons/ZoomScan.tsx diff --git a/dev/main.css b/engine/dev/main.css similarity index 100% rename from dev/main.css rename to engine/dev/main.css diff --git a/dev/main.tsx b/engine/dev/main.tsx similarity index 89% rename from dev/main.tsx rename to engine/dev/main.tsx index 4d76175..eb38b06 100644 --- a/dev/main.tsx +++ b/engine/dev/main.tsx @@ -7,16 +7,7 @@ import { Show, } from "solid-js"; import { render } from "solid-js/web"; -import { InputField } from "#/dev/controls/InputField.tsx"; -import { RangeSlider } from "#/dev/controls/RangeSlider.tsx"; -import { ItemList, type ItemsRef } from "#/dev/ItemList.tsx"; -import { ArrowAutofitHeightIcon } from "#/dev/icons/ArrowAutofitHeight.tsx"; -import { ArrowAutofitWidthIcon } from "#/dev/icons/ArrowAutofitWidth.tsx"; -import { FileIcon } from "#/dev/icons/File.tsx"; -import { LetterXIcon } from "#/dev/icons/LetterX.tsx"; -import { LetterYIcon } from "#/dev/icons/LetterY.tsx"; -import { ZoomScanIcon } from "#/dev/icons/ZoomScan.tsx"; -import { type Animation, spriteMap } from "#/engine/Animation.ts"; +import { spriteMap } from "#/engine/Animation.ts"; import type { Entity } from "#/engine/Entity.ts"; import { currentScene, @@ -27,7 +18,16 @@ import { setScene, } from "#/engine/Scene.ts"; import { setScale, viewport } from "#/engine/Viewport.ts"; +import { InputField } from "./controls/InputField.tsx"; +import { RangeSlider } from "./controls/RangeSlider.tsx"; import { GraphBrowser } from "./GraphBrowser.tsx"; +import { ItemList, type ItemsRef } from "./ItemList.tsx"; +import { ArrowAutofitHeightIcon } from "./icons/ArrowAutofitHeight.tsx"; +import { ArrowAutofitWidthIcon } from "./icons/ArrowAutofitWidth.tsx"; +import { FileIcon } from "./icons/File.tsx"; +import { LetterXIcon } from "./icons/LetterX.tsx"; +import { LetterYIcon } from "./icons/LetterY.tsx"; +import { ZoomScanIcon } from "./icons/ZoomScan.tsx"; async function fetchScenes(): Promise { const indexRef: string[] = await (await fetch(`/api/scenes`)).json(); @@ -192,7 +192,7 @@ const DevTools: Component<{ gameContainer: HTMLElement }> = ({ - + diff --git a/dev/server/middleware.ts b/engine/dev/server/middleware.ts similarity index 80% rename from dev/server/middleware.ts rename to engine/dev/server/middleware.ts index aa5caaf..946c0a5 100644 --- a/dev/server/middleware.ts +++ b/engine/dev/server/middleware.ts @@ -1,5 +1,6 @@ import { readdirSync, writeFileSync } from "node:fs"; import type { IncomingMessage, ServerResponse } from "node:http"; +import { root } from "../../../vite.config.ts"; function buildBrowserIndex(dir: string): string[] { const dirents = readdirSync(dir, { @@ -10,11 +11,19 @@ function buildBrowserIndex(dir: string): string[] { return dirents .filter((dirent) => dirent.isFile()) .map((dirent) => { - const path = dirent.parentPath.substring(dir.length); + const path = dirent.parentPath.substring(dir.length - 1); + return `${path}/${dirent.name}`; }); } +function getScenes(req: IncomingMessage, res: ServerResponse) { + const sceneData = buildBrowserIndex(`${root}/game/scenes`); + + res.writeHead(200, { "Content-Type": "application/json" }); + res.end(JSON.stringify(sceneData)); +} + function get(req: IncomingMessage, res: ServerResponse): void { const match = req.url?.match(/^\/(\w+)$/); if (!match) { @@ -24,10 +33,12 @@ function get(req: IncomingMessage, res: ServerResponse): void { return; } - const sceneData = buildBrowserIndex(match[1]); - - res.writeHead(200, { "Content-Type": "application/json" }); - res.end(JSON.stringify(sceneData)); + switch (req.url) { + case "/scenes": { + getScenes(req, res); + break; + } + } } function post(req: IncomingMessage, res: ServerResponse): void { diff --git a/lib/cache.ts b/engine/lib/cache.ts similarity index 100% rename from lib/cache.ts rename to engine/lib/cache.ts diff --git a/lib/lerp.ts b/engine/lib/lerp.ts similarity index 100% rename from lib/lerp.ts rename to engine/lib/lerp.ts diff --git a/lib/loadImage.ts b/engine/lib/loadImage.ts similarity index 100% rename from lib/loadImage.ts rename to engine/lib/loadImage.ts diff --git a/lib/mulberry32.ts b/engine/lib/mulberry32.ts similarity index 100% rename from lib/mulberry32.ts rename to engine/lib/mulberry32.ts diff --git a/entities/barEntity/entity.ts b/entities/barEntity/entity.ts deleted file mode 100644 index da3e686..0000000 --- a/entities/barEntity/entity.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { createAnimation, playAnimation } from "#/engine/Animation.ts"; -import { defineEntity } from "#/engine/Entity.ts"; -import { fromSrc, type Sprite } from "#/lib/Sprite.ts"; - -const idle: Sprite = await fromSrc("/assets/hero/idle.png", 5, 4); - -const { animate, process } = defineEntity("barEntity", { - animation: createAnimation(idle, 200, 0), - stuff: 1, -}); - -animate((entity, ctx, delta) => { - playAnimation( - ctx, - entity.animation, - entity.position.x, - entity.position.y, - delta, - ); -}); - -process((entity, delta) => { - entity.position.x += entity.stuff * 0.5; - if (entity.position.x > 64) { - entity.stuff = -1; - } else if (entity.position.x < 0) { - entity.stuff = 1; - } -}); diff --git a/assets/char-idle.png b/game/assets/char-idle.png similarity index 100% rename from assets/char-idle.png rename to game/assets/char-idle.png diff --git a/assets/char-walk.png b/game/assets/char-walk.png similarity index 100% rename from assets/char-walk.png rename to game/assets/char-walk.png diff --git a/public/assets/hero/idle.png b/game/assets/hero/idle.png similarity index 100% rename from public/assets/hero/idle.png rename to game/assets/hero/idle.png diff --git a/public/assets/hero/walk.png b/game/assets/hero/walk.png similarity index 100% rename from public/assets/hero/walk.png rename to game/assets/hero/walk.png diff --git a/public/hex-grid.svg b/game/assets/hex-grid.svg similarity index 100% rename from public/hex-grid.svg rename to game/assets/hex-grid.svg diff --git a/assets/bgm.wav b/game/assets/music/bgm.wav similarity index 100% rename from assets/bgm.wav rename to game/assets/music/bgm.wav diff --git a/public/assets/hain.wav b/game/assets/music/hain.wav similarity index 100% rename from public/assets/hain.wav rename to game/assets/music/hain.wav diff --git a/assets/portal.png b/game/assets/portal.png similarity index 100% rename from assets/portal.png rename to game/assets/portal.png diff --git a/assets/portal2.png b/game/assets/portal2.png similarity index 100% rename from assets/portal2.png rename to game/assets/portal2.png diff --git a/assets/tiles.png b/game/assets/tiles.png similarity index 100% rename from assets/tiles.png rename to game/assets/tiles.png diff --git a/public/assets/tileset.png b/game/assets/tileset.png similarity index 100% rename from public/assets/tileset.png rename to game/assets/tileset.png diff --git a/entities/hero/entity.ts b/game/entities/hero/entity.ts similarity index 88% rename from entities/hero/entity.ts rename to game/entities/hero/entity.ts index 679ae52..88e9d7b 100644 --- a/entities/hero/entity.ts +++ b/game/entities/hero/entity.ts @@ -1,9 +1,9 @@ -import charIdle from "#/assets/char-idle.png"; import { createAnimation, playAnimation } from "#/engine/Animation.ts"; import { defineEntity } from "#/engine/Entity.ts"; import { keyboardInput } from "#/engine/Keyboard.ts"; import { pointer } from "#/engine/Pointer.ts"; -import { fromSrc, type Sprite } from "#/lib/Sprite.ts"; +import { fromSrc, type Sprite } from "#/engine/Sprite.ts"; +import charIdle from "#/game/assets/char-idle.png"; const idle: Sprite = await fromSrc(charIdle, 2, 4); diff --git a/entities/portal/entity.ts b/game/entities/portal/entity.ts similarity index 69% rename from entities/portal/entity.ts rename to game/entities/portal/entity.ts index 9fa8487..3fe4ff8 100644 --- a/entities/portal/entity.ts +++ b/game/entities/portal/entity.ts @@ -1,8 +1,9 @@ import { createAnimation, playAnimation } from "#/engine/Animation.ts"; import { defineEntity } from "#/engine/Entity.ts"; -import { fromSrc, type Sprite } from "#/lib/Sprite.ts"; +import { fromSrc, type Sprite } from "#/engine/Sprite.ts"; +import portal from "#/game/assets/portal.png"; -const sprite: Sprite = await fromSrc("./assets/portal.png", 3, 1); +const sprite: Sprite = await fromSrc(portal, 3, 1); const { animate } = defineEntity("portal", { animation: createAnimation(sprite, 400, 0), diff --git a/entities/testEntity/entity.ts b/game/entities/testEntity/entity.ts similarity index 83% rename from entities/testEntity/entity.ts rename to game/entities/testEntity/entity.ts index d110cfe..0333739 100644 --- a/entities/testEntity/entity.ts +++ b/game/entities/testEntity/entity.ts @@ -1,14 +1,14 @@ -import charIdle from "#/assets/char-idle.png"; -import charWalk from "#/assets/char-walk.png"; import { type Animation, createAnimation, playAnimation, } from "#/engine/Animation.ts"; import { defineEntity } from "#/engine/Entity.ts"; +import { loadImage } from "#/engine/lib/loadImage.ts"; +import { createSprite } from "#/engine/Sprite.ts"; import { viewport } from "#/engine/Viewport.ts"; -import { loadImage } from "#/lib/loadImage.ts"; -import { createSprite } from "#/lib/Sprite.ts"; +import charIdle from "#/game/assets/char-idle.png"; +import charWalk from "#/game/assets/char-walk.png"; const sprites = { idle: createSprite(await loadImage(charIdle), 2, 4), diff --git a/scenes/barScene/data.json b/game/scenes/barScene/data.json similarity index 64% rename from scenes/barScene/data.json rename to game/scenes/barScene/data.json index 4b9a117..675f68a 100644 --- a/scenes/barScene/data.json +++ b/game/scenes/barScene/data.json @@ -9,13 +9,6 @@ "x": 0, "y": 0 } - }, - { - "name": "barEntity", - "position": { - "x": 24, - "y": 16 - } } ] } diff --git a/scenes/barScene/scene.ts b/game/scenes/barScene/scene.ts similarity index 100% rename from scenes/barScene/scene.ts rename to game/scenes/barScene/scene.ts diff --git a/scenes/fooScene/data.json b/game/scenes/fooScene/data.json similarity index 88% rename from scenes/fooScene/data.json rename to game/scenes/fooScene/data.json index ff66eb0..6b49044 100644 --- a/scenes/fooScene/data.json +++ b/game/scenes/fooScene/data.json @@ -11,7 +11,7 @@ } }, { - "name": "hero", + "name": "testEntity", "position": { "x": 24, "y": 16 diff --git a/scenes/fooScene/scene.ts b/game/scenes/fooScene/scene.ts similarity index 100% rename from scenes/fooScene/scene.ts rename to game/scenes/fooScene/scene.ts diff --git a/scenes/testScene/data.json b/game/scenes/testScene/data.json similarity index 100% rename from scenes/testScene/data.json rename to game/scenes/testScene/data.json diff --git a/scenes/testScene/scene.ts b/game/scenes/testScene/scene.ts similarity index 88% rename from scenes/testScene/scene.ts rename to game/scenes/testScene/scene.ts index 3bc8e45..11def94 100644 --- a/scenes/testScene/scene.ts +++ b/game/scenes/testScene/scene.ts @@ -1,11 +1,11 @@ import { pointer } from "#/engine/Pointer.ts"; import { defineScene } from "#/engine/Scene.ts"; -import type { Vector } from "#/lib/Vector.ts"; +import type { Vector } from "#/engine/Vector.ts"; import data from "./data.json"; const { process, preProcess, linkScenes } = defineScene(data); -linkScenes(["fooScene", "fuzzScene"] as const); +linkScenes(["fooScene"] as const); preProcess((entityInstanceMap) => { const entity = entityInstanceMap.get(data.entities[0].name); diff --git a/main.ts b/main.ts index aa96629..d688c91 100644 --- a/main.ts +++ b/main.ts @@ -1,3 +1,4 @@ +import { listenKeyboard } from "#/engine/Keyboard.ts"; import { listenPointer } from "#/engine/Pointer.ts"; import { currentScene, setScene } from "#/engine/Scene.ts"; import { @@ -6,7 +7,6 @@ import { resizeCanvas, viewport, } from "#/engine/Viewport.ts"; -import { listenKeyboard } from "./engine/Keyboard.ts"; let then = self.performance.now(); let delta = 0; @@ -21,7 +21,7 @@ function animate(timestamp: number): void { (async () => { if (import.meta.env.DEV) { - import("#/dev/main.tsx").then((m) => m.use(viewport.gameContainer)); + import("#/engine/dev/main").then((m) => m.use(viewport.gameContainer)); } initViewport(); diff --git a/package.json b/package.json index cdcfbdf..9dee6c7 100644 --- a/package.json +++ b/package.json @@ -6,10 +6,10 @@ "check": "biome check --write" }, "devDependencies": { - "@biomejs/biome": "2.3.11", - "@types/bun": "1.3.6", + "@biomejs/biome": "2.3.14", + "@types/bun": "1.3.8", "lz-string": "1.5.0", - "solid-js": "1.9.10", + "solid-js": "1.9.11", "vite": "7.3.1", "vite-plugin-solid": "2.11.10" }, diff --git a/public/assets/bgm.wav b/public/assets/bgm.wav deleted file mode 100644 index fccd683..0000000 Binary files a/public/assets/bgm.wav and /dev/null differ diff --git a/public/assets/char-idle.png b/public/assets/char-idle.png deleted file mode 100644 index 79c6232..0000000 Binary files a/public/assets/char-idle.png and /dev/null differ diff --git a/public/assets/char-walk.png b/public/assets/char-walk.png deleted file mode 100644 index 3336233..0000000 Binary files a/public/assets/char-walk.png and /dev/null differ diff --git a/public/assets/portal.png b/public/assets/portal.png deleted file mode 100644 index cd09fd2..0000000 Binary files a/public/assets/portal.png and /dev/null differ diff --git a/public/assets/portal2.png b/public/assets/portal2.png deleted file mode 100644 index 408d4ab..0000000 Binary files a/public/assets/portal2.png and /dev/null differ diff --git a/public/assets/tiles.png b/public/assets/tiles.png deleted file mode 100644 index 0b7196d..0000000 Binary files a/public/assets/tiles.png and /dev/null differ diff --git a/scenes/fuzzScene/data.json b/scenes/fuzzScene/data.json deleted file mode 100644 index 9b4965c..0000000 --- a/scenes/fuzzScene/data.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "fuzzScene", - "width": 240, - "height": 160, - "entities": [ - { - "name": "barEntity", - "position": { - "x": 0, - "y": 0 - } - }, - { - "name": "barEntity", - "position": { - "x": 24, - "y": 16 - } - } - ] -} diff --git a/scenes/fuzzScene/scene.ts b/scenes/fuzzScene/scene.ts deleted file mode 100644 index bccf16b..0000000 --- a/scenes/fuzzScene/scene.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineScene } from "#/engine/Scene.ts"; -import data from "./data.json"; - -const { process, linkScenes } = defineScene(data); - -linkScenes(["testScene"] as const); - -process((_ctx, _delta) => {}); diff --git a/vite.config.ts b/vite.config.ts index 270c83b..1558f2b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,10 +1,11 @@ import { fileURLToPath, URL } from "node:url"; import { defineConfig, type Plugin } from "vite"; import solidPlugin from "vite-plugin-solid"; -import middleware from "#/dev/server/middleware.ts"; +import middleware from "#/engine/dev/server/middleware.ts"; export const host = "localhost"; export const port = 3080; +export const root = fileURLToPath(new URL("./", import.meta.url)); function devTools(): Plugin { return { @@ -21,7 +22,7 @@ export default defineConfig({ plugins: [solidPlugin(), devTools()], resolve: { alias: { - "#/": fileURLToPath(new URL("./", import.meta.url)), + "#/": root, }, }, });