Initial commit
This commit is contained in:
commit
c27332b8bd
15 changed files with 3891 additions and 0 deletions
89
.gitignore
vendored
Normal file
89
.gitignore
vendored
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# Webpack
|
||||||
|
.webpack/
|
||||||
|
|
||||||
|
# Electron-Forge
|
||||||
|
out/
|
59
package.json
Normal file
59
package.json
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
"name": "minequack",
|
||||||
|
"productName": "minequack",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"licence": "The Unlicense",
|
||||||
|
"description": "My Electron application description",
|
||||||
|
"main": "src/index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "electron-forge start",
|
||||||
|
"package": "electron-forge package",
|
||||||
|
"make": "electron-forge make",
|
||||||
|
"publish": "electron-forge publish",
|
||||||
|
"lint": "echo \"No linting configured\""
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": {
|
||||||
|
"name": "TheRedX",
|
||||||
|
"email": "56270596+TheRedXD@users.noreply.github.com"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"config": {
|
||||||
|
"forge": {
|
||||||
|
"packagerConfig": {},
|
||||||
|
"makers": [
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-squirrel",
|
||||||
|
"config": {
|
||||||
|
"name": "minequack"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-zip",
|
||||||
|
"platforms": [
|
||||||
|
"darwin"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-deb",
|
||||||
|
"config": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "@electron-forge/maker-rpm",
|
||||||
|
"config": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"electron-squirrel-startup": "^1.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@electron-forge/cli": "6.0.0-beta.52",
|
||||||
|
"@electron-forge/maker-deb": "6.0.0-beta.52",
|
||||||
|
"@electron-forge/maker-rpm": "6.0.0-beta.52",
|
||||||
|
"@electron-forge/maker-squirrel": "6.0.0-beta.52",
|
||||||
|
"@electron-forge/maker-zip": "6.0.0-beta.52",
|
||||||
|
"electron": "15.3.0"
|
||||||
|
}
|
||||||
|
}
|
0
src/app/game.js
Normal file
0
src/app/game.js
Normal file
304
src/app/render.js
Normal file
304
src/app/render.js
Normal file
|
@ -0,0 +1,304 @@
|
||||||
|
const scene = new THREE.Scene();
|
||||||
|
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
|
||||||
|
|
||||||
|
const renderer = new THREE.WebGLRenderer();
|
||||||
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||||
|
|
||||||
|
const gameStats = {
|
||||||
|
fps: 0,
|
||||||
|
playerName: 'TheRed'
|
||||||
|
}
|
||||||
|
|
||||||
|
function existCheck(id, metadata) {
|
||||||
|
let check = require('fs').existsSync(__dirname+'/app/resources/'+id+'/textures.json');
|
||||||
|
if(check) {
|
||||||
|
file = require(__dirname+'/app/resources/'+id+'/textures.json');
|
||||||
|
console.log(file);
|
||||||
|
if(file[metadata] == undefined) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if(!require('fs').existsSync(__dirname+'/app/resources/'+id+'/'+file[metadata].f)) {
|
||||||
|
console.log('1')
|
||||||
|
return false;
|
||||||
|
} else if(!require('fs').existsSync(__dirname+'/app/resources/'+id+'/'+file[metadata].b)) {
|
||||||
|
console.log('2')
|
||||||
|
return false;
|
||||||
|
} else if(!require('fs').existsSync(__dirname+'/app/resources/'+id+'/'+file[metadata].l)) {
|
||||||
|
console.log('3')
|
||||||
|
return false;
|
||||||
|
} else if(!require('fs').existsSync(__dirname+'/app/resources/'+id+'/'+file[metadata].r)) {
|
||||||
|
console.log('4')
|
||||||
|
return false;
|
||||||
|
} else if(!require('fs').existsSync(__dirname+'/app/resources/'+id+'/'+file[metadata].u)) {
|
||||||
|
console.log('5')
|
||||||
|
return false;
|
||||||
|
} else if(!require('fs').existsSync(__dirname+'/app/resources/'+id+'/'+file[metadata].d)) {
|
||||||
|
console.log('6')
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
console.log('7')
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description AssembledCube creates a cube using 6 planes, which makes it easier to optimize (also applies a texture and cube size, position)
|
||||||
|
* @example new AssembledCube('stone', theTexture, 1, [0,0,0]);
|
||||||
|
*/
|
||||||
|
class AssembledCube {
|
||||||
|
constructor(id, texture, size, position) {
|
||||||
|
let x = size;
|
||||||
|
let y = size;
|
||||||
|
this.id = id;
|
||||||
|
this.texture = texture;
|
||||||
|
this.position = position;
|
||||||
|
let geometry1 = new THREE.PlaneGeometry( x, y );
|
||||||
|
let texture1 = new THREE.TextureLoader().load(__dirname+'/app/resources/'+this.id+'/'+this.texture.f);
|
||||||
|
texture1.magFilter = THREE.NearestFilter; // Makes so the texture isnt blurry, instead it becomes pixely (kinda like minecraft)
|
||||||
|
let material1 = new THREE.MeshBasicMaterial( {map: texture1, side: THREE.BackSide} );
|
||||||
|
let plane1 = new THREE.Mesh( geometry1, material1 );
|
||||||
|
|
||||||
|
let geometry2 = new THREE.PlaneGeometry( x, y );
|
||||||
|
let texture2 = new THREE.TextureLoader().load(__dirname+'/app/resources/'+this.id+'/'+this.texture.b);
|
||||||
|
texture2.magFilter = THREE.NearestFilter; // Makes so the texture isnt blurry, instead it becomes pixely (kinda like minecraft)
|
||||||
|
let material2 = new THREE.MeshBasicMaterial( {map: texture2, side: THREE.BackSide} );
|
||||||
|
let plane2 = new THREE.Mesh( geometry2, material2 );
|
||||||
|
|
||||||
|
let geometry3 = new THREE.PlaneGeometry( x, y );
|
||||||
|
let texture3 = new THREE.TextureLoader().load(__dirname+'/app/resources/'+this.id+'/'+this.texture.l);
|
||||||
|
texture3.magFilter = THREE.NearestFilter; // Makes so the texture isnt blurry, instead it becomes pixely (kinda like minecraft)
|
||||||
|
let material3 = new THREE.MeshBasicMaterial( {map: texture3, side: THREE.BackSide} );
|
||||||
|
let plane3 = new THREE.Mesh( geometry3, material3 );
|
||||||
|
|
||||||
|
let geometry4 = new THREE.PlaneGeometry( x, y );
|
||||||
|
let texture4 = new THREE.TextureLoader().load(__dirname+'/app/resources/'+this.id+'/'+this.texture.r);
|
||||||
|
texture4.magFilter = THREE.NearestFilter; // Makes so the texture isnt blurry, instead it becomes pixely (kinda like minecraft)
|
||||||
|
let material4 = new THREE.MeshBasicMaterial( {map: texture4, side: THREE.BackSide} );
|
||||||
|
let plane4 = new THREE.Mesh( geometry4, material4 );
|
||||||
|
|
||||||
|
let geometry5 = new THREE.PlaneGeometry( x, y );
|
||||||
|
let texture5 = new THREE.TextureLoader().load(__dirname+'/app/resources/'+this.id+'/'+this.texture.u);
|
||||||
|
texture5.magFilter = THREE.NearestFilter; // Makes so the texture isnt blurry, instead it becomes pixely (kinda like minecraft)
|
||||||
|
let material5 = new THREE.MeshBasicMaterial( {map: texture5, side: THREE.BackSide} );
|
||||||
|
let plane5 = new THREE.Mesh( geometry5, material5 );
|
||||||
|
|
||||||
|
let geometry6 = new THREE.PlaneGeometry( x, y );
|
||||||
|
let texture6 = new THREE.TextureLoader().load(__dirname+'/app/resources/'+this.id+'/'+this.texture.d);
|
||||||
|
texture6.magFilter = THREE.NearestFilter; // Makes so the texture isnt blurry, instead it becomes pixely (kinda like minecraft)
|
||||||
|
let material6 = new THREE.MeshBasicMaterial( {map: texture6, side: THREE.BackSide} );
|
||||||
|
let plane6 = new THREE.Mesh( geometry6, material6 );
|
||||||
|
|
||||||
|
plane1.position.x = this.position[0];
|
||||||
|
plane1.position.y = this.position[1];
|
||||||
|
plane1.position.z = this.position[2]+x/2;
|
||||||
|
|
||||||
|
plane2.position.x = this.position[0];
|
||||||
|
plane2.position.y = this.position[1];
|
||||||
|
plane2.position.z = this.position[2]-x/2;
|
||||||
|
|
||||||
|
plane3.position.x = this.position[0]+x/2;
|
||||||
|
plane3.position.y = this.position[1];
|
||||||
|
plane3.position.z = this.position[2];
|
||||||
|
|
||||||
|
plane4.position.x = this.position[0]-x/2;
|
||||||
|
plane4.position.y = this.position[1];
|
||||||
|
plane4.position.z = this.position[2];
|
||||||
|
|
||||||
|
plane5.position.x = this.position[0];
|
||||||
|
plane5.position.y = this.position[1]+x/2;
|
||||||
|
plane5.position.z = this.position[2];
|
||||||
|
|
||||||
|
plane6.position.x = this.position[0];
|
||||||
|
plane6.position.y = this.position[1]-x/2;
|
||||||
|
plane6.position.z = this.position[2];
|
||||||
|
|
||||||
|
plane1.rotation.y = 0*(Math.PI/180)
|
||||||
|
plane2.rotation.y = 180*(Math.PI/180)
|
||||||
|
plane3.rotation.y = 90*(Math.PI/180)
|
||||||
|
plane4.rotation.y = -90*(Math.PI/180)
|
||||||
|
|
||||||
|
plane5.rotation.x = -90*(Math.PI/180)
|
||||||
|
plane6.rotation.x = 90*(Math.PI/180)
|
||||||
|
|
||||||
|
this.plane1 = plane1;
|
||||||
|
this.plane2 = plane2;
|
||||||
|
this.plane3 = plane3;
|
||||||
|
this.plane4 = plane4;
|
||||||
|
this.plane5 = plane5;
|
||||||
|
this.plane6 = plane6;
|
||||||
|
}
|
||||||
|
return() {
|
||||||
|
return [this.plane1, this.plane2, this.plane3, this.plane4, this.plane5, this.plane6];
|
||||||
|
}
|
||||||
|
update(positiona) {
|
||||||
|
this.plane1.position.x = positiona[0];
|
||||||
|
this.plane1.position.y = positiona[1];
|
||||||
|
this.plane1.position.z = positiona[2]+this.size/2;
|
||||||
|
|
||||||
|
this.plane2.position.x = positiona[0];
|
||||||
|
this.plane2.position.y = positiona[1];
|
||||||
|
this.plane2.position.z = positiona[2]-this.size/2;
|
||||||
|
|
||||||
|
this.plane3.position.x = positiona[0]+this.size/2;
|
||||||
|
this.plane3.position.y = positiona[1];
|
||||||
|
this.plane3.position.z = positiona[2];
|
||||||
|
|
||||||
|
this.plane4.position.x = positiona[0]-this.size/2;
|
||||||
|
this.plane4.position.y = positiona[1];
|
||||||
|
this.plane4.position.z = positiona[2];
|
||||||
|
|
||||||
|
this.plane5.position.x = positiona[0];
|
||||||
|
this.plane5.position.y = positiona[1]+this.size/2;
|
||||||
|
this.plane5.position.z = positiona[2];
|
||||||
|
|
||||||
|
this.plane6.position.x = positiona[0];
|
||||||
|
this.plane6.position.y = positiona[1]-this.size/2;
|
||||||
|
this.plane6.position.z = positiona[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @description This class is used for creating players
|
||||||
|
* @example new Player("TheBlueBurger", [0, 0, 0], [0, 0])
|
||||||
|
*/
|
||||||
|
class Player {
|
||||||
|
constructor(playername, position, rotation) {
|
||||||
|
this.name = playername;
|
||||||
|
this.position = position;
|
||||||
|
this.rotation = rotation;
|
||||||
|
}
|
||||||
|
update(positiona, rotationa) {
|
||||||
|
this.position[0] = positiona[0];
|
||||||
|
this.position[1] = positiona[1];
|
||||||
|
this.position[2] = positiona[2];
|
||||||
|
|
||||||
|
this.rotation[2] = 0;
|
||||||
|
this.rotation[0] = rotationa[1];
|
||||||
|
this.rotation[1] = rotationa[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class World {
|
||||||
|
constructor() {
|
||||||
|
this.constants = {
|
||||||
|
g: 9.81, // meters per second squared
|
||||||
|
bs: 1 // meters
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Block {
|
||||||
|
constructor(position, id, metadata) {
|
||||||
|
this.position = position;
|
||||||
|
this.id = id;
|
||||||
|
this.metadata = metadata;
|
||||||
|
|
||||||
|
this.texture = getTexture(this.id, this.metadata)
|
||||||
|
}
|
||||||
|
return() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Skybox {
|
||||||
|
constructor(x) {
|
||||||
|
this.position = [0, 0, -x/2]; // sets the default skybox position
|
||||||
|
this.id = 'stone'; // texture id
|
||||||
|
this.metadata = 0; // metadata
|
||||||
|
this.size = x; // the size of skybox
|
||||||
|
this.texture = getTexture(this.id, this.metadata) // get the texture using id and metadata
|
||||||
|
this.cube = new AssembledCube(this.texture.id, this.texture, this.size, this.position); // create a cube (6 seperate planes instead of a whole cube so easier to optimize)
|
||||||
|
} // line 50
|
||||||
|
update(positiona) {
|
||||||
|
this.cube.update(positiona)
|
||||||
|
}
|
||||||
|
return() {
|
||||||
|
console.log(this.texture);
|
||||||
|
return this.cube; // returns our cube
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let player = new Player('TheRedPotato', [0, 1, 0], [0, 0])
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
let cube;
|
||||||
|
// setInterval(() => {i++},1000)
|
||||||
|
// setTimeout(() => {
|
||||||
|
// window.open("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
|
||||||
|
// }, 50000)
|
||||||
|
function getTexture(id, metadata) {
|
||||||
|
let check = !existCheck(id, metadata);
|
||||||
|
console.log(check);
|
||||||
|
if(check) {
|
||||||
|
let texture = require(__dirname+'/app/resources/undefined/textures.json')[0];
|
||||||
|
texture.id = 'undefined';
|
||||||
|
return texture;
|
||||||
|
} else {
|
||||||
|
let texture = require(__dirname+'/app/resources/'+id+'/textures.json')[metadata];
|
||||||
|
texture.id = id;
|
||||||
|
return texture;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function genBlockArray(x, z, position) {
|
||||||
|
for(i = 0;i<z;i++) { // leave it alone, aint used for now but its just something i keep so that i can have a refference point later when i do generation
|
||||||
|
for(i2 = 0; i2<x; i2++) {
|
||||||
|
pos = [position.x+i2, position.y, position.z+i];
|
||||||
|
scene.add(new Block(pos, 'stone', 0).return());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function render() {
|
||||||
|
requestAnimationFrame( render );
|
||||||
|
// gameStats.fps = performance.now();
|
||||||
|
// console.log(gameStats.fps/i);
|
||||||
|
cube.rotation.y += 0.01;
|
||||||
|
cube.rotation.x += 0.0101;
|
||||||
|
|
||||||
|
// player.update(player.position, [player.rotation[0], player.rotation[1]])
|
||||||
|
camera.position.x = player.position[0]
|
||||||
|
camera.position.y = player.position[1]
|
||||||
|
camera.position.z = player.position[2]
|
||||||
|
|
||||||
|
// camera.rotation.x = player.rotation[2]
|
||||||
|
camera.rotation.y = player.rotation[1]
|
||||||
|
camera.rotation.z = player.rotation[0]
|
||||||
|
skybox.update(player.position);
|
||||||
|
renderer.render(scene, camera)
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener( 'resize', onWindowResize, false );
|
||||||
|
|
||||||
|
function onWindowResize(){
|
||||||
|
|
||||||
|
camera.aspect = window.innerWidth / window.innerHeight;
|
||||||
|
camera.updateProjectionMatrix();
|
||||||
|
|
||||||
|
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup() {
|
||||||
|
document.body.appendChild( renderer.domElement );
|
||||||
|
const geometry = new THREE.BoxGeometry( 1, 1, 1 );
|
||||||
|
const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
|
||||||
|
cube = new THREE.Mesh( geometry, material );
|
||||||
|
scene.add( cube );
|
||||||
|
cube.position.z = -10;
|
||||||
|
scene.add(skyboxobj.plane1)
|
||||||
|
scene.add(skyboxobj.plane2)
|
||||||
|
scene.add(skyboxobj.plane3)
|
||||||
|
scene.add(skyboxobj.plane4)
|
||||||
|
scene.add(skyboxobj.plane5)
|
||||||
|
scene.add(skyboxobj.plane6)
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
let skybox = new Skybox(300);
|
||||||
|
let skyboxobj = new Skybox(300).return();
|
||||||
|
setup();
|
||||||
|
// can i test something? sure
|
BIN
src/app/resources/skybox/1.png
Normal file
BIN
src/app/resources/skybox/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 559 B |
12
src/app/resources/skybox/textures.json
Normal file
12
src/app/resources/skybox/textures.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"f": "1.png",
|
||||||
|
"b": "1.png",
|
||||||
|
"l": "1.png",
|
||||||
|
"r": "1.png",
|
||||||
|
"u": "1.png",
|
||||||
|
"d": "1.png",
|
||||||
|
"t": false,
|
||||||
|
"m": "inner"
|
||||||
|
}
|
||||||
|
]
|
BIN
src/app/resources/stone/1.png
Normal file
BIN
src/app/resources/stone/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 512 B |
12
src/app/resources/stone/textures.json
Normal file
12
src/app/resources/stone/textures.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"f": "1.png",
|
||||||
|
"b": "1.png",
|
||||||
|
"l": "1.png",
|
||||||
|
"r": "1.png",
|
||||||
|
"u": "1.png",
|
||||||
|
"d": "1.png",
|
||||||
|
"t": false,
|
||||||
|
"m": "outer"
|
||||||
|
}
|
||||||
|
]
|
BIN
src/app/resources/undefined/1.png
Normal file
BIN
src/app/resources/undefined/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 571 B |
12
src/app/resources/undefined/textures.json
Normal file
12
src/app/resources/undefined/textures.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"f": "1.png",
|
||||||
|
"b": "1.png",
|
||||||
|
"l": "1.png",
|
||||||
|
"r": "1.png",
|
||||||
|
"u": "1.png",
|
||||||
|
"d": "1.png",
|
||||||
|
"t": false,
|
||||||
|
"m": "both"
|
||||||
|
}
|
||||||
|
]
|
4
src/index.css
Normal file
4
src/index.css
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
* {
|
||||||
|
padding: 0 auto;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
15
src/index.html
Normal file
15
src/index.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Minequack 1.0</title>
|
||||||
|
<link rel="stylesheet" href="index.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script src="libs/three.min.js"></script>
|
||||||
|
<script src="app/game.js"></script>
|
||||||
|
<script src="app/render.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
50
src/index.js
Normal file
50
src/index.js
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
const { app, BrowserWindow } = require('electron');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
|
||||||
|
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
const createWindow = () => {
|
||||||
|
// Create the browser window.
|
||||||
|
const mainWindow = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
|
allowRunningInsecureContent: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// and load the index.html of the app.
|
||||||
|
mainWindow.loadFile(path.join(__dirname, 'index.html'));
|
||||||
|
mainWindow.setMenuBarVisibility(false);
|
||||||
|
// Open the DevTools.
|
||||||
|
};
|
||||||
|
|
||||||
|
// This method will be called when Electron has finished
|
||||||
|
// initialization and is ready to create browser windows.
|
||||||
|
// Some APIs can only be used after this event occurs.
|
||||||
|
app.on('ready', createWindow);
|
||||||
|
|
||||||
|
// Quit when all windows are closed, except on macOS. There, it's common
|
||||||
|
// for applications and their menu bar to stay active until the user quits
|
||||||
|
// explicitly with Cmd + Q.
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('activate', () => {
|
||||||
|
// On OS X it's common to re-create a window in the app when the
|
||||||
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
|
createWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// In this file you can include the rest of your app's specific main process
|
||||||
|
// code. You can also put them in separate files and import them here.
|
6
src/libs/three.min.js
vendored
Normal file
6
src/libs/three.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue