Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/jsLinters/eslint.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/web/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="stylesheet" href="style.css" />
<title>Title</title>
</head>
<body>
<body style="margin: 0">
<script type="module" src="index.ts"></script>
<div id="nanoforge-loader">
<img id="loader-logo" src="assets/logo.png" alt="logo" />
Expand Down
16 changes: 3 additions & 13 deletions apps/web/src/loader/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,16 @@ const logger = new Logger("Loader");
export const loadGameFiles = async (
manifest: IExtendedManifest,
): Promise<[IGameOptions["files"], any]> => {
const files = {
assets: new Map<string, string>(),
wasm: new Map<string, string>(),
wgsl: new Map<string, string>(),
};
const files = new Map<string, string>();
let mainModule = undefined;
logger.info("Starting load game files from cache");
for (const file of manifest.files) {
if (file.path.endsWith(".js")) {
if (file.path === "/index.js") {
const resModule = await loadScript(file);
if (resModule) mainModule = resModule;
continue;
}
if (file.path.endsWith(".wasm")) {
files.wasm.set(file.path, file.localPath);
} else if (file.path.endsWith(".wgsl")) {
files.wgsl.set(file.path, file.localPath);
} else {
files.assets.set(file.path, file.localPath);
}
files.set(file.path, file.localPath);
}
if (!mainModule) throw new Error("Could not find main function");
logger.info("Game files loaded");
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
font-weight: bold;
color: white;
position: absolute;
z-index: 1000;
display: flex;
flex-direction: column;
justify-content: center;
Expand Down
6 changes: 1 addition & 5 deletions apps/web/src/types/game.type.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
export interface IGameOptions {
canvas: HTMLCanvasElement;
files: {
assets: Map<string, string>;
wasm: Map<string, string>;
wgsl: Map<string, string>;
};
files: Map<string, string>;
}