可以在问题底部的截图中看到,也可以 直接进入游戏.文本的放置取决于浏览器(firefox 15.0.1的呈现方式与IE 9.9和Chrome 21不同).调用绘图功能:
context.fillText(this.wlines[i], this.xcoord, this.ycoord + y + (t) * this.sizey);
Run Code Online (Sandbox Code Playgroud)
对象的构造函数:
function textItem(text, xcoord, ycoord, sizex, sizey,style, context) {
this.wlines = [];
this.text = text;
this.xcoord = xcoord;
this.ycoord = ycoord;
this.sizex = sizex;
this.sizey = sizey;
this.style = style;
if (text == null) {
text = "";
}
var lines = text.split("~");
// this is first line text
context.save();
if (this.style < 3) {
context.shadowOffsetY = 2;
context.font = 'bold 18px "palatino linotype"';
} …Run Code Online (Sandbox Code Playgroud)