Sha256: 7cb88e1fb52a7dff767c1b5f8b6be733410778a3e663ece7bf86420a2298004e

Contents?: true

Size: 661 Bytes

Versions: 2

Compression:

Stored size: 661 Bytes

Contents

/*
The text component displays font on screen using the canvas font api.

//create font
re.e('text')
.defines({
	text:'Texting Message',
	textColor:'#ff0000'
});

TODO implement size

*/
re.c('text')
.requires('draw')
.defaults({
	font:"14px sans-serif",
	textColor:'#000000',
	textAlign:'',
	font_text:''
})
.defines({
	
	visible:function(){
		return this._text && this.parent('draw', 'visible')
	},
	
	text:function(t){
    if(re.is(t)){
  		this._text = t;
      return this;
    }
		return this._text;
	},
	
	draw:function(c){
		
		c.font = this.font;
		c.fillStyle = this.textColor;
		c.fillText(this._text, -this.regX, -this.regY);
		return this;
	}
	
});

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
entityjs-0.3.1 src/display/text.js
entityjs-0.3.0 src/display/text.js