Resource pathing fixes

This commit is contained in:
Lucas Dower 2021-08-20 16:14:35 +01:00
parent 7d0de30ac6
commit 1741529526
4 changed files with 9 additions and 5 deletions

View File

@ -25,13 +25,14 @@
"@types/bootstrap": "^5.1.1",
"@types/jquery": "^3.5.6",
"@types/pngjs": "^6.0.1",
"bootstrap": "^5.1.0",
"electron": "^13.1.4",
"electron-packager": "^15.2.0",
"ts-node": "^10.1.0",
"typescript": "^4.3.5"
},
"dependencies": {
"@popperjs/core": "^2.9.3",
"bootstrap": "^5.1.0",
"expand-vertex-data": "^1.1.2",
"jpeg-js": "^0.4.3",
"pngjs": "^6.0.0",

View File

@ -3,6 +3,7 @@ import { HashMap } from "./hash_map";
import { UV, RGB } from "./util";
//import blocks from "../resources/blocks.json";
import fs from "fs";
import path from "path";
interface BlockInfo {
name: string;
@ -25,7 +26,9 @@ export class BlockAtlas {
constructor() {
this._cachedBlocks = new HashMap(1024);
const blocksString = fs.readFileSync("./resources/blocks.json", "utf-8");
const _path = path.join(__dirname, "../resources/blocks.json");
console.log(_path);
const blocksString = fs.readFileSync(_path, "utf-8");
if (!blocksString) {
throw Error("Could not load blocks.json")
}

View File

@ -20,8 +20,7 @@ function createWindow () {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
},
icon: "./resources/icon.png"
}
});
//mainWindow.removeMenu();

View File

@ -1,4 +1,5 @@
import * as twgl from "twgl.js";
import path from "path";
import { Vector3 } from "./vector";
import { ArcballCamera } from "./camera";
@ -55,7 +56,7 @@ export class Renderer {
this._materialBuffers = [];
this._atlasTexture = twgl.createTexture(this._gl, {
src: "./resources/blocks.png",
src: path.join(__dirname, "../resources/blocks.png"),
mag: this._gl.NEAREST
});