New Input handler implemented.

This commit is contained in:
Richard Davey
2013-05-16 02:36:58 +01:00
parent ce7bfd1fc2
commit 3cdd2baff0
31 changed files with 3048 additions and 2029 deletions
+1 -2
View File
@@ -1,7 +1,7 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
// Here we create a quite tiny game (320x240 in size)
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update);
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update, render);
function init() {
// This sets a limit on the up-scale
myGame.stage.scale.maxWidth = 640;
@@ -16,7 +16,6 @@
for(var i = 0; i < 1000; i++) {
myGame.createSprite(myGame.world.randomX, myGame.world.randomY, 'melon');
}
myGame.onRenderCallback = render;
}
function update() {
if(myGame.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
+1 -3
View File
@@ -3,7 +3,7 @@
(function () {
// Here we create a quite tiny game (320x240 in size)
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update);
var myGame = new Phaser.Game(this, 'game', 320, 240, init, create, update, render);
function init() {
@@ -29,8 +29,6 @@
myGame.createSprite(myGame.world.randomX, myGame.world.randomY, 'melon');
}
myGame.onRenderCallback = render;
}
function update() {
+12 -5
View File
@@ -1,16 +1,23 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
// Here we create a quite tiny game (320x240 in size)
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
// Tell Phaser that we want it to scale up to whatever the browser can handle, but to do it proportionally
myGame.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
myGame.loader.addImageFile('dragonsun', 'assets/pics/cougar_dragonsun.png');
myGame.loader.load();
}
function create() {
myGame.onRenderCallback = render;
console.log('dragons 8');
myGame.input.onDown.add(test1, this);
}
function test1() {
console.log('down');
}
function update() {
}
function render() {
myGame.input.pointer1.renderDebug();
myGame.input.pointer2.renderDebug();
myGame.input.pointer3.renderDebug();
myGame.input.pointer4.renderDebug();
}
})();
+15 -6
View File
@@ -2,29 +2,38 @@
(function () {
// Here we create a quite tiny game (320x240 in size)
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update);
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
// Tell Phaser that we want it to scale up to whatever the browser can handle, but to do it proportionally
myGame.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;
myGame.loader.addImageFile('dragonsun', 'assets/pics/cougar_dragonsun.png');
myGame.loader.load();
}
function create() {
myGame.onRenderCallback = render;
console.log('dragons 8');
myGame.input.onDown.add(test1, this);
}
function update() {
function test1() {
console.log('down');
}
function update() {
}
function render() {
myGame.input.pointer1.renderDebug();
myGame.input.pointer2.renderDebug();
myGame.input.pointer3.renderDebug();
myGame.input.pointer4.renderDebug();
}
+19
View File
@@ -0,0 +1,19 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
}
function create() {
// We lock the game to allowing only 1 Pointer active
// This means on multi-touch systems it will ignore any extra fingers placed down beyond the first
myGame.input.maxPointers = 1;
}
function update() {
}
function render() {
myGame.input.renderDebugInfo(16, 16);
myGame.input.pointer1.renderDebug(true);
myGame.input.pointer2.renderDebug(true);
myGame.input.pointer3.renderDebug(true);
}
})();
+31
View File
@@ -0,0 +1,31 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var myGame = new Phaser.Game(this, 'game', 800, 600, init, create, update, render);
function init() {
}
function create() {
// We lock the game to allowing only 1 Pointer active
// This means on multi-touch systems it will ignore any extra fingers placed down beyond the first
myGame.input.maxPointers = 1;
}
function update() {
}
function render() {
myGame.input.renderDebugInfo(16, 16);
myGame.input.pointer1.renderDebug(true);
myGame.input.pointer2.renderDebug(true);
myGame.input.pointer3.renderDebug(true);
}
})();