summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/index.ts51
-rw-r--r--src/renderer/controller/collision.ts (renamed from src/controller/collision.ts)0
-rw-r--r--src/renderer/controller/entitycontext.ts (renamed from src/controller/entitycontext.ts)0
-rw-r--r--src/renderer/controller/gamecontext.ts (renamed from src/controller/gamecontext.ts)0
-rw-r--r--src/renderer/custom.d.ts9
-rw-r--r--src/renderer/index.css20
-rw-r--r--src/renderer/index.ts (renamed from src/index.ts)12
-rw-r--r--src/renderer/math/circle.ts (renamed from src/math/circle.ts)0
-rw-r--r--src/renderer/math/collision.ts (renamed from src/math/collision.ts)0
-rw-r--r--src/renderer/math/line.ts (renamed from src/math/line.ts)0
-rw-r--r--src/renderer/math/point.ts (renamed from src/math/point.ts)0
-rw-r--r--src/renderer/model/data/collision.ts (renamed from src/model/data/collision.ts)0
-rw-r--r--src/renderer/model/data/entity.ts (renamed from src/model/data/entity.ts)0
-rw-r--r--src/renderer/model/data/map.ts (renamed from src/model/data/map.ts)0
-rw-r--r--src/renderer/util.ts (renamed from src/util.ts)0
-rw-r--r--src/renderer/view/entity.ts (renamed from src/view/entity.ts)0
-rw-r--r--src/renderer/view/input/gameinput.ts (renamed from src/view/input/gameinput.ts)0
-rw-r--r--src/renderer/view/input/inputhandler.ts (renamed from src/view/input/inputhandler.ts)0
-rw-r--r--src/renderer/view/map.ts (renamed from src/view/map.ts)2
-rw-r--r--src/renderer/view/renderer/renderer.ts (renamed from src/view/renderer/renderer.ts)0
-rw-r--r--src/renderer/view/renderer/shaders.ts (renamed from src/view/renderer/shaders.ts)0
-rw-r--r--src/renderer/view/renderer/shaders/default.fs (renamed from src/view/renderer/shaders/default.fs)0
-rw-r--r--src/renderer/view/renderer/shaders/default.vs (renamed from src/view/renderer/shaders/default.vs)0
-rw-r--r--src/renderer/view/sprite.ts (renamed from src/view/sprite.ts)0
-rw-r--r--src/renderer/view/util/image.ts (renamed from src/view/util/image.ts)1
25 files changed, 90 insertions, 5 deletions
diff --git a/src/main/index.ts b/src/main/index.ts
new file mode 100644
index 0000000..a4beb71
--- /dev/null
+++ b/src/main/index.ts
@@ -0,0 +1,51 @@
+import { app, BrowserWindow } from 'electron';
+import * as path from 'path';
+import { format as formatUrl } from 'url';
+
+const isDevelopment = process.env.NODE_ENV !== 'production';
+
+let mainWindow: BrowserWindow|null = null;
+
+function getIndexURL(): string {
+ if (isDevelopment)
+ return `http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`;
+
+ return formatUrl({
+ pathname: path.join(__dirname, 'index.html'),
+ protocol: 'file',
+ slashes: true,
+ });
+}
+
+function createMainWindow(): BrowserWindow {
+ const window = new BrowserWindow();
+
+ if (isDevelopment)
+ window.webContents.openDevTools();
+
+ window.loadURL(getIndexURL());
+
+ window.on('closed', () => {
+ mainWindow = null;
+ });
+
+ window.webContents.on('devtools-opened', () => {
+ window.webContents.focus();
+ });
+
+ return window;
+}
+
+app.on('window-all-closed', () => {
+ if (process.platform !== 'darwin')
+ app.quit();
+});
+
+app.on('activate', () => {
+ if (!mainWindow)
+ mainWindow = createMainWindow();
+});
+
+app.on('ready', () => {
+ mainWindow = createMainWindow();
+});
diff --git a/src/controller/collision.ts b/src/renderer/controller/collision.ts
index a44ffa4..a44ffa4 100644
--- a/src/controller/collision.ts
+++ b/src/renderer/controller/collision.ts
diff --git a/src/controller/entitycontext.ts b/src/renderer/controller/entitycontext.ts
index 434bf9b..434bf9b 100644
--- a/src/controller/entitycontext.ts
+++ b/src/renderer/controller/entitycontext.ts
diff --git a/src/controller/gamecontext.ts b/src/renderer/controller/gamecontext.ts
index 9a68e25..9a68e25 100644
--- a/src/controller/gamecontext.ts
+++ b/src/renderer/controller/gamecontext.ts
diff --git a/src/renderer/custom.d.ts b/src/renderer/custom.d.ts
new file mode 100644
index 0000000..b54bb07
--- /dev/null
+++ b/src/renderer/custom.d.ts
@@ -0,0 +1,9 @@
+declare module "*.vs" {
+ const content: string;
+ export default content;
+}
+
+declare module "*.fs" {
+ const content: string;
+ export default content;
+}
diff --git a/src/renderer/index.css b/src/renderer/index.css
new file mode 100644
index 0000000..afdf217
--- /dev/null
+++ b/src/renderer/index.css
@@ -0,0 +1,20 @@
+html, body, div {
+ width: 100%;
+ height: 100%;
+}
+
+#app {
+ text-align: center;
+}
+
+canvas {
+ position: relative;
+ top: calc(50% - 384px);
+}
+
+* {
+ margin: 0px;
+ padding: 0px;
+ border: 0px;
+ background: #223;
+}
diff --git a/src/index.ts b/src/renderer/index.ts
index 4db13d5..039c3b6 100644
--- a/src/index.ts
+++ b/src/renderer/index.ts
@@ -1,12 +1,20 @@
+import './index.css';
+
import { GameContext } from './controller/gamecontext';
import { Renderer } from './view/renderer/renderer';
window.onload = async () => {
- const canvas = document.getElementById('rpgedit') as HTMLCanvasElement;
- if (!canvas)
+ const app = document.getElementById('app');
+ if (!app)
return;
+ const canvas = document.createElement('canvas');
+ canvas.width = 1024;
+ canvas.height = 768;
+
+ app.append(canvas);
+
const renderer = new Renderer(canvas);
GameContext.load(renderer);
diff --git a/src/math/circle.ts b/src/renderer/math/circle.ts
index f4e855a..f4e855a 100644
--- a/src/math/circle.ts
+++ b/src/renderer/math/circle.ts
diff --git a/src/math/collision.ts b/src/renderer/math/collision.ts
index 3df811a..3df811a 100644
--- a/src/math/collision.ts
+++ b/src/renderer/math/collision.ts
diff --git a/src/math/line.ts b/src/renderer/math/line.ts
index db99035..db99035 100644
--- a/src/math/line.ts
+++ b/src/renderer/math/line.ts
diff --git a/src/math/point.ts b/src/renderer/math/point.ts
index 0865b8f..0865b8f 100644
--- a/src/math/point.ts
+++ b/src/renderer/math/point.ts
diff --git a/src/model/data/collision.ts b/src/renderer/model/data/collision.ts
index 29d0879..29d0879 100644
--- a/src/model/data/collision.ts
+++ b/src/renderer/model/data/collision.ts
diff --git a/src/model/data/entity.ts b/src/renderer/model/data/entity.ts
index f52c130..f52c130 100644
--- a/src/model/data/entity.ts
+++ b/src/renderer/model/data/entity.ts
diff --git a/src/model/data/map.ts b/src/renderer/model/data/map.ts
index 81ce051..81ce051 100644
--- a/src/model/data/map.ts
+++ b/src/renderer/model/data/map.ts
diff --git a/src/util.ts b/src/renderer/util.ts
index cea404b..cea404b 100644
--- a/src/util.ts
+++ b/src/renderer/util.ts
diff --git a/src/view/entity.ts b/src/renderer/view/entity.ts
index ec91503..ec91503 100644
--- a/src/view/entity.ts
+++ b/src/renderer/view/entity.ts
diff --git a/src/view/input/gameinput.ts b/src/renderer/view/input/gameinput.ts
index 67fbe0c..67fbe0c 100644
--- a/src/view/input/gameinput.ts
+++ b/src/renderer/view/input/gameinput.ts
diff --git a/src/view/input/inputhandler.ts b/src/renderer/view/input/inputhandler.ts
index 17abfe6..17abfe6 100644
--- a/src/view/input/inputhandler.ts
+++ b/src/renderer/view/input/inputhandler.ts
diff --git a/src/view/map.ts b/src/renderer/view/map.ts
index 5eedaca..18def05 100644
--- a/src/view/map.ts
+++ b/src/renderer/view/map.ts
@@ -7,8 +7,6 @@ import { MapData } from '../model/data/map';
import { nextPowerOf2 } from '../util';
-import { vec2 } from 'gl-matrix';
-
interface StaticMapTile {
type: 'static';
image: HTMLImageElement;
diff --git a/src/view/renderer/renderer.ts b/src/renderer/view/renderer/renderer.ts
index 93f8589..93f8589 100644
--- a/src/view/renderer/renderer.ts
+++ b/src/renderer/view/renderer/renderer.ts
diff --git a/src/view/renderer/shaders.ts b/src/renderer/view/renderer/shaders.ts
index 8fd1fda..8fd1fda 100644
--- a/src/view/renderer/shaders.ts
+++ b/src/renderer/view/renderer/shaders.ts
diff --git a/src/view/renderer/shaders/default.fs b/src/renderer/view/renderer/shaders/default.fs
index 2c8ad15..2c8ad15 100644
--- a/src/view/renderer/shaders/default.fs
+++ b/src/renderer/view/renderer/shaders/default.fs
diff --git a/src/view/renderer/shaders/default.vs b/src/renderer/view/renderer/shaders/default.vs
index 4715a17..4715a17 100644
--- a/src/view/renderer/shaders/default.vs
+++ b/src/renderer/view/renderer/shaders/default.vs
diff --git a/src/view/sprite.ts b/src/renderer/view/sprite.ts
index 3a5ebcb..3a5ebcb 100644
--- a/src/view/sprite.ts
+++ b/src/renderer/view/sprite.ts
diff --git a/src/view/util/image.ts b/src/renderer/view/util/image.ts
index 0ad5d16..37c5e7f 100644
--- a/src/view/util/image.ts
+++ b/src/renderer/view/util/image.ts
@@ -1,5 +1,4 @@
import { Renderer } from '../renderer/renderer';
-import { SpriteCoords } from '../sprite';
export function loadImage(url: string): Promise<HTMLImageElement> {
return new Promise((resolve, reject) => {