Skip to content

Commit

Permalink
Resource pathing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasDower committed Aug 20, 2021
1 parent 7d0de30 commit 1741529
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 4 additions & 1 deletion src/block_atlas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")
}
Expand Down
3 changes: 1 addition & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ function createWindow () {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
},
icon: "./resources/icon.png"
}
});
//mainWindow.removeMenu();

Expand Down
3 changes: 2 additions & 1 deletion src/renderer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as twgl from "twgl.js";
import path from "path";

import { Vector3 } from "./vector";
import { ArcballCamera } from "./camera";
Expand Down Expand Up @@ -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
});

Expand Down

0 comments on commit 1741529

Please sign in to comment.