From 8f5a43219bd01e3d294dd9f69d64b26944520dba Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 5 Mar 2019 15:42:29 +1100 Subject: [PATCH] remove webgl from combat --- client/src/scenes/combat.js | 28 ++++++++++++++++------------ client/src/scenes/cryps.js | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/client/src/scenes/combat.js b/client/src/scenes/combat.js index 7cc402f6..b405ee15 100644 --- a/client/src/scenes/combat.js +++ b/client/src/scenes/combat.js @@ -1,7 +1,7 @@ const Phaser = require('phaser'); const { throttle } = require('lodash'); -const { POSITIONS: { COMBAT }} = require('./constants'); +const { TEXT, POSITIONS: { COMBAT }} = require('./constants'); const CombatLog = require('./combat.log'); const CombatCryps = require('./combat.cryps'); const CombatSkills = require('./combat.skills'); @@ -102,17 +102,21 @@ class Combat extends Phaser.Scene { addLeaveGame() { const leaveGame = () => this.cleanUp(); this.input.keyboard.on('keydown_BACKSPACE', leaveGame, 0, this); - const buttonProps = { - x: COMBAT.width() * 0.8, - y: COMBAT.height() * 0.8, - width: COMBAT.width() * 0.15, - height: COMBAT.height() * 0.1, - colour: [0.7, 0.2, 0], - glTag: 'leave', - bText: 'Leave Game', - callback: leaveGame, - }; - this.box = this.add.existing(new Button(this, buttonProps)); + + const LEAVE_HEIGHT = COMBAT.height() / 6; + const LEAVE_WIDTH = COMBAT.width() / 5; + const LEAVE_X = COMBAT.width() * 0.8; + const LEAVE_Y = COMBAT.height() * 0.9; + + const menu = this.add + .rectangle(LEAVE_X, LEAVE_Y, LEAVE_WIDTH, LEAVE_HEIGHT, 0x440000) + .setInteractive() + .setOrigin(0) + .on('pointerdown', () => this.registry.set('home', true)); + + this.add + .text(menu.getCenter().x, menu.getCenter().y, 'Menu', TEXT.HEADER) + .setOrigin(0.5, 0.5); } cleanUp() { diff --git a/client/src/scenes/cryps.js b/client/src/scenes/cryps.js index 04c286d6..b63c0512 100644 --- a/client/src/scenes/cryps.js +++ b/client/src/scenes/cryps.js @@ -9,7 +9,7 @@ const Combat = require('./combat'); function renderCryps() { const config = { - type: Phaser.AUTO, + type: Phaser.CANVAS, // backgroundColor: '#181818', resolution: window.devicePixelRatio, scale: {