First commit

This commit is contained in:
Hamcha 2019-11-19 15:29:12 +01:00
commit b1893aceba
Signed by: hamcha
GPG Key ID: 44AD3571EB09A39E
12 changed files with 6324 additions and 0 deletions

3
.babelrc Normal file
View File

@ -0,0 +1,3 @@
{
"presets": ["env", "react"]
}

2
.browserslistrc Normal file
View File

@ -0,0 +1,2 @@
> 1%
last 2 versions

14
.eslintrc.js Normal file
View File

@ -0,0 +1,14 @@
module.exports = {
root: true,
env: {
node: true
},
extends: [],
rules: {
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
},
parserOptions: {
parser: "@typescript-eslint/parser"
}
};

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
dist
.cache
node_modules

25
package.json Normal file
View File

@ -0,0 +1,25 @@
{
"name": "world-player",
"version": "1.0.0",
"main": "dist/bundle.js",
"license": "ISC",
"scripts": {
"build": "parcel build -d dist src/index.html",
"serve": "parcel src/index.html"
},
"dependencies": {
"@types/react": "^16.9.11",
"@types/react-dom": "^16.9.4",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"json5": "^2.1.1",
"parcel-bundler": "^1.12.4",
"phaser": "^3.20.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"typescript": "^3.7.2"
},
"devDependencies": {
"babel-core": "^6.26.3"
}
}

34
src/game/Game.ts Normal file
View File

@ -0,0 +1,34 @@
import * as Phaser from "phaser";
import { UI } from "../ui";
export class Game {
private phaser: Phaser.Game;
private ui: UI;
constructor(ui: UI) {
this.ui = ui;
const gameConfig: Phaser.Types.Core.GameConfig = {
title: "Player",
type: Phaser.AUTO,
scale: {
width: window.innerWidth,
height: window.innerHeight
},
physics: {
default: "arcade",
arcade: {
debug: true
}
},
backgroundColor: "#000000"
};
this.phaser = new Phaser.Game(gameConfig);
}
}

1
src/game/index.ts Normal file
View File

@ -0,0 +1 @@
export * from "./Game";

37
src/index.html Normal file
View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Player</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta http-equiv="cleartype" content="on">
<style>
html,
body,
canvas,
div {
margin: 0 !important;
padding: 0 !important;
overflow: hidden !important;
}
#ui {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
color: white;
}
</style>
</head>
<body>
<div id="ui"></div>
<script src="main.ts"></script>
</body>
</html>

5
src/main.ts Normal file
View File

@ -0,0 +1,5 @@
import { Game } from "./game";
import { UI } from "./ui";
const ui = new UI();
const game = new Game(ui);

19
src/ui/index.tsx Normal file
View File

@ -0,0 +1,19 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
const Hello = () => {
return <div></div>;
};
export class UI {
private root: JSX.Element;
constructor() {
this.root = <Hello />;
this.mount();
}
mount() {
ReactDOM.render(this.root, document.getElementById("ui"));
}
}

10
tsconfig.json Normal file
View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"jsx": "react",
"moduleResolution": "node",
"lib": ["dom", "es5", "es6"]
},
"include": ["src/**/*"]
}

6171
yarn.lock Normal file

File diff suppressed because it is too large Load Diff