class Screen
{
canvas = null ;
ctx = null ;
width = 0 ;
height = 0 ;
alpha = 1 ;
font_size = 0 ;
line_height = 0 ;
mode = "source-over";
Dispose()
{
this.ctx = null ;
this.canvas.remove();
this.canvas = null ;
}
constructor(order)
{
this.canvas = document.createElement("CANVAS") ;
this.canvas.width = this.width = µB.$Config.width ;
this.canvas.height = this.height = µB.$Config.height ;
this.canvas.className = "d2" ;
this.canvas.style.zIndex = order ;
General.AppendChild(this.canvas);
this.ctx = this.canvas.getContext("2d", {willReadFrequently:true});
this.ctx.textRendering = "optimizeSpeed" ;
this.SetFont(4) ;
this.Mode("source-over") ;
Log("new Layer z=" + order + " " + this.canvas.width + "x" + this.canvas.height );
}
Resize(x, y)
{
this.width = x*1;
this.height = y*1;
this.canvas.width = this.width;
this.canvas.height = this.height;
}
Clear()
{
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
}
SetFont(size)
{
this.line_height = Math.round(this.canvas.height * (size/100),2);
this.font_size = Math.round(this.canvas.height * ((size/1.2)/100),2);
this.ctx.font = this.font_size + "px " + MONO_FONT ;
this.ctx.textBaseline = "top" ;
}
/*
Color($hex)
{
this.$C.fillStyle = this.$font_color ;
this.$C.strokeStyle = this.$font_color ;
}
*/
Mode(mode)
{
this.mode = mode ;
this.ctx.globalCompositeOperation = mode;
}
};