added scaling text, fits to y dimension; formatted js

This commit is contained in:
meadowstream 2014-06-22 00:26:46 -04:00
parent 5179a5f434
commit 4a3386e87a
2 changed files with 8 additions and 4 deletions

View file

@ -9,12 +9,15 @@ function Text(x,y,text,font,color,incrementFunction){
this.draw = function(){
if(this.alive>0){
ctx.save();
var sf = settings.scale;
ctx.scale(sf, sf);
ctx.font= this.font;
ctx.fillStyle = this.color;
ctx.globalAlpha = this.opacity;
ctx.fillText(this.text,this.x+gdx,this.y+gdy);
ctx.fillText(this.text,(this.x + gdx) * (1/sf), (this.y + gdy) * (1/sf));
ctx.globalAlpha =1;
//this.opacity = 1-(Date.now()-MainClock.lastCombo)/5000;
ctx.restore();
incrementFunction(this);
return true;
}

View file

@ -4,10 +4,11 @@ var hexagonBackgroundColorClear = 'rgba(236, 240, 241, 0.5)';
var centerBlue = '#2c3e50'; //tumblr?
function renderText(x, y, fontSize, color, text) {
ctx.font = fontSize + 'px/0 Roboto';
fontSize *= settings.scale;
ctx.font = fontSize + 'px/0 Roboto';
ctx.textAlign = 'center';
ctx.fillStyle = color;
ctx.fillText(text, x, y + (fontSize / 4) + 3.5);
ctx.fillText(text, x, y + (fontSize / 2) - 9 * settings.scale);
}
scoreOpacity = 0;