From 85f84517f6db2f3d89dd4a3862b5eda3d527211b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 1 May 2020 22:23:41 +0200 Subject: [PATCH] Adding logo in the bottom right corner and placing help text in function of height --- front/src/Phaser/Components/TextField.ts | 4 ++-- front/src/Phaser/Login/LogincScene.ts | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/front/src/Phaser/Components/TextField.ts b/front/src/Phaser/Components/TextField.ts index 427a25ab..61a6f096 100644 --- a/front/src/Phaser/Components/TextField.ts +++ b/front/src/Phaser/Components/TextField.ts @@ -1,7 +1,7 @@ export class TextField extends Phaser.GameObjects.Text { constructor(scene: Phaser.Scene, x: number, y: number, text: string | string[]) { - super(scene, x, y, text, { fontFamily: 'Arial', fontSize: "20px", color: '#ffffff'}); + super(scene, x, y, text, { fontFamily: 'Arial', fontSize: "15px", color: '#ffffff'}); this.scene.add.existing(this) } -} \ No newline at end of file +} diff --git a/front/src/Phaser/Login/LogincScene.ts b/front/src/Phaser/Login/LogincScene.ts index 15ead519..42d46766 100644 --- a/front/src/Phaser/Login/LogincScene.ts +++ b/front/src/Phaser/Login/LogincScene.ts @@ -3,11 +3,13 @@ import {TextField} from "../Components/TextField"; import {TextInput} from "../Components/TextInput"; import {ClickButton} from "../Components/ClickButton"; import {GameSceneName} from "../Game/GameScene"; +import Image = Phaser.GameObjects.Image; //todo: put this constants in a dedicated file export const LoginSceneName = "LoginScene"; enum LoginTextures { playButton = "play_button", + icon = "icon" } export class LogincScene extends Phaser.Scene { @@ -15,6 +17,7 @@ export class LogincScene extends Phaser.Scene { private textField: TextField; private playButton: ClickButton; private infoTextField: TextField; + private logo: Image; constructor() { super({ @@ -24,18 +27,23 @@ export class LogincScene extends Phaser.Scene { preload() { this.load.image(LoginTextures.playButton, "resources/objects/play_button.png"); + this.load.image(LoginTextures.icon, "resources/logos/tcm_full.png"); } create() { - this.textField = new TextField(this, 10, 10, 'Enter your email:'); + this.textField = new TextField(this, 10, 10, 'Enter your name:'); this.emailInput = new TextInput(this, 10, 50); let x = this.game.renderer.width / 2; let y = this.game.renderer.height / 2; this.playButton = new ClickButton(this, x, y, LoginTextures.playButton, this.login.bind(this)); - let infoText = "Commandes de base: \n - Z,Q,S,D (ou les flèches de direction) pour bouger\n - SHIFT pour accélerer"; - this.infoTextField = new TextField(this, 10, 300, infoText); + this.logo = new Image(this, this.game.renderer.width - 30, this.game.renderer.height - 20, LoginTextures.icon); + this.add.existing(this.logo); + + + let infoText = "Commands: \n - Arrows or Z,Q,S,D to move\n - SHIFT to run"; + this.infoTextField = new TextField(this, 10, this.game.renderer.height - 60, infoText); } update(time: number, delta: number): void { @@ -49,4 +57,4 @@ export class LogincScene extends Phaser.Scene { this.scene.start(GameSceneName); }); } -} \ No newline at end of file +}