Comparing version 2.0.3 to 2.0.4
@@ -11,4 +11,4 @@ import { Handle } from './handle'; | ||
readonly config: Config; | ||
readonly canvas: Canvas; | ||
readonly handle: Handle; | ||
static canvas: Canvas; | ||
static handle: Handle; | ||
fps: number; | ||
@@ -15,0 +15,0 @@ private frameCount; |
@@ -17,8 +17,8 @@ define(["require", "exports", "./text", "./handle", "./canvas", "./config", "rxjs/Observable", "rxjs/add/operator/map", "rxjs/add/observable/merge", "rxjs/add/observable/interval", "rxjs/add/operator/share"], function (require, exports, text_1, handle_1, canvas_1, config_1, Observable_1) { | ||
} | ||
this.canvas = new canvas_1.Canvas(this.config.canvas); | ||
this.handle = new handle_1.Handle(this.canvas.canvasElm); | ||
Gine.canvas = new canvas_1.Canvas(this.config.canvas); | ||
Gine.handle = new handle_1.Handle(Gine.canvas.canvasElm); | ||
this.fpsMs = 1000 / this.config.maxFps; | ||
this.tickMs = 1000 / this.config.tickRate; | ||
this.handle.setFont(new text_1.Font('Helvetica', 16)); | ||
this.handle.setColor(0, 0, 0, 0.8); | ||
Gine.handle.setFont(new text_1.Font('Helvetica', 16)); | ||
Gine.handle.setColor(0, 0, 0, 0.8); | ||
var ticks = Observable_1.Observable.interval(this.tickMs).map(function () { return 'tick'; }); | ||
@@ -50,9 +50,9 @@ var frames = Observable_1.Observable.interval(this.fpsMs).map(function () { return 'frame'; }); | ||
Gine.prototype.frame = function () { | ||
this.handle.clear(); | ||
this.handle.setColor(0, 0, 0); | ||
this.handle.handle.fillRect(1, 1, config_1.CONFIG.width - 2, config_1.CONFIG.height - 2); | ||
this.handle.setFont(new text_1.Font('Helvetica', 10)); | ||
this.handle.setColor(0, 255, 0); | ||
this.handle.text("" + this.fps + 'fps', 5, 16); | ||
this.handle.text("" + this.tickrate + ' tickrate', 5, 40); | ||
Gine.handle.clear(); | ||
Gine.handle.setColor(0, 0, 0); | ||
Gine.handle.handle.fillRect(1, 1, config_1.CONFIG.width - 2, config_1.CONFIG.height - 2); | ||
Gine.handle.setFont(new text_1.Font('Helvetica', 10)); | ||
Gine.handle.setColor(0, 255, 0); | ||
Gine.handle.text("" + this.fps + 'fps', 5, 16); | ||
Gine.handle.text("" + this.tickrate + ' tickrate', 5, 40); | ||
this.frameCount++; | ||
@@ -59,0 +59,0 @@ window.requestAnimationFrame(function () { }); |
{ | ||
"name": "gine", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Gine game engine.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -14,4 +14,4 @@ import { Font } from './text'; | ||
static readonly canvas: Canvas | ||
static readonly handle: Handle | ||
static canvas: Canvas | ||
static handle: Handle | ||
public fps: number = 0 | ||
@@ -35,9 +35,9 @@ private frameCount: number = 0 | ||
} | ||
this.canvas = new Canvas(this.config.canvas) | ||
this.handle = new Handle(this.canvas.canvasElm) | ||
Gine.canvas = new Canvas(this.config.canvas) | ||
Gine.handle = new Handle(Gine.canvas.canvasElm) | ||
this.fpsMs = 1000 / this.config.maxFps | ||
this.tickMs = 1000 / this.config.tickRate | ||
this.handle.setFont(new Font('Helvetica', 16)) | ||
this.handle.setColor(0,0,0,0.8) | ||
Gine.handle.setFont(new Font('Helvetica', 16)) | ||
Gine.handle.setColor(0,0,0,0.8) | ||
@@ -74,9 +74,9 @@ const ticks = Observable.interval(this.tickMs).map(() => 'tick') | ||
frame(): void { | ||
this.handle.clear() | ||
this.handle.setColor(0,0,0) | ||
this.handle.handle.fillRect(1, 1, CONFIG.width-2, CONFIG.height-2) | ||
this.handle.setFont(new Font('Helvetica', 10)) | ||
this.handle.setColor(0, 255, 0) | ||
this.handle.text(""+this.fps+'fps', 5, 16) | ||
this.handle.text(""+this.tickrate+' tickrate', 5, 40) | ||
Gine.handle.clear() | ||
Gine.handle.setColor(0,0,0) | ||
Gine.handle.handle.fillRect(1, 1, CONFIG.width-2, CONFIG.height-2) | ||
Gine.handle.setFont(new Font('Helvetica', 10)) | ||
Gine.handle.setColor(0, 255, 0) | ||
Gine.handle.text(""+this.fps+'fps', 5, 16) | ||
Gine.handle.text(""+this.tickrate+' tickrate', 5, 40) | ||
this.frameCount++ | ||
@@ -83,0 +83,0 @@ window.requestAnimationFrame( () => {} ) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
351353