UI Changes

This commit is contained in:
Henry Wang
2017-02-24 01:17:49 -06:00
parent 6e9377387d
commit 4a0bd33a44
4 changed files with 17 additions and 8 deletions

View File

@@ -446,7 +446,7 @@ $(function() {
var barOffset; var barOffset;
ctx.fillStyle = "white"; ctx.fillStyle = "white";
ctx.font = "24px Arial"; ctx.font = "24px Changa";
barOffset = ctx.measureText(user.name).width + 10; barOffset = ctx.measureText(user.name).width + 10;
ctx.fillText(user.name, 5, CELL_WIDTH - 5); ctx.fillText(user.name, 5, CELL_WIDTH - 5);
@@ -462,7 +462,7 @@ $(function() {
//Percentage //Percentage
ctx.fillStyle = "white"; ctx.fillStyle = "white";
ctx.font = "18px Arial"; ctx.font = "18px Changa";
ctx.fillText((lagPortion * 100).toFixed(3) + "%", 5 + barOffset, CELL_WIDTH - 5); ctx.fillText((lagPortion * 100).toFixed(3) + "%", 5 + barOffset, CELL_WIDTH - 5);
if (user.dead && !showedDead) if (user.dead && !showedDead)

View File

@@ -417,7 +417,12 @@ Player.prototype.render = function(ctx, fade)
//Render name //Render name
ctx.fillStyle = this.shadowColor.deriveAlpha(fade).rgbString(); ctx.fillStyle = this.shadowColor.deriveAlpha(fade).rgbString();
ctx.textAlign = "center"; ctx.textAlign = "center";
ctx.fillText(this.name, this.posX + CELL_WIDTH / 2, this.posY - SHADOW_OFFSET * 2);
var yoff = -SHADOW_OFFSET * 2
if (this.row === 0)
yoff = SHADOW_OFFSET * 2 + CELL_WIDTH;
ctx.font = "18px Changa";
ctx.fillText(this.name, this.posX + CELL_WIDTH / 2, this.posY + yoff);
}; };
function move(data) function move(data)

View File

@@ -533,7 +533,7 @@ $(function() {
var barOffset; var barOffset;
ctx.fillStyle = "white"; ctx.fillStyle = "white";
ctx.font = "24px Arial"; ctx.font = "24px Changa";
barOffset = ctx.measureText(user.name).width + 10; barOffset = ctx.measureText(user.name).width + 10;
ctx.fillText(user.name, 5, CELL_WIDTH - 5); ctx.fillText(user.name, 5, CELL_WIDTH - 5);
@@ -549,7 +549,7 @@ $(function() {
//Percentage //Percentage
ctx.fillStyle = "white"; ctx.fillStyle = "white";
ctx.font = "18px Arial"; ctx.font = "18px Changa";
ctx.fillText((lagPortion * 100).toFixed(3) + "%", 5 + barOffset, CELL_WIDTH - 5); ctx.fillText((lagPortion * 100).toFixed(3) + "%", 5 + barOffset, CELL_WIDTH - 5);
if (user.dead && !showedDead) if (user.dead && !showedDead)
@@ -656,8 +656,6 @@ function defineInstanceMethods(thisobj, data /*, methods...*/)
thisobj[arguments[i].name] = arguments[i].bind(this, data); thisobj[arguments[i].name] = arguments[i].bind(this, data);
} }
function defineAccessorProperties(thisobj, data /*, names...*/) function defineAccessorProperties(thisobj, data /*, names...*/)
{ {
var descript = {}; var descript = {};
@@ -1060,7 +1058,12 @@ Player.prototype.render = function(ctx, fade)
//Render name //Render name
ctx.fillStyle = this.shadowColor.deriveAlpha(fade).rgbString(); ctx.fillStyle = this.shadowColor.deriveAlpha(fade).rgbString();
ctx.textAlign = "center"; ctx.textAlign = "center";
ctx.fillText(this.name, this.posX + CELL_WIDTH / 2, this.posY - SHADOW_OFFSET * 2);
var yoff = -SHADOW_OFFSET * 2
if (this.row === 0)
yoff = SHADOW_OFFSET * 2 + CELL_WIDTH;
ctx.font = "18px Changa";
ctx.fillText(this.name, this.posX + CELL_WIDTH / 2, this.posY + yoff);
}; };
function move(data) function move(data)

View File

@@ -1,4 +1,5 @@
<head> <head>
<link href="https://fonts.googleapis.com/css?family=Changa:600" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="bundle.js"></script> <script src="bundle.js"></script>
<style> <style>