Update CanvasScript.hx
This commit is contained in:
parent
252e0dc7f3
commit
5cde1487ca
|
@ -60,7 +60,8 @@ class CanvasScript extends Trait {
|
|||
|
||||
notifyOnRender2D(function(g: kha.graphics2.Graphics) {
|
||||
if (canvas == null) return;
|
||||
|
||||
|
||||
setCanvasDimensions(kha.System.windowWidth(), kha.System.windowHeight());
|
||||
var events = Canvas.draw(cui, canvas, g);
|
||||
|
||||
for (e in events) {
|
||||
|
@ -110,7 +111,16 @@ class CanvasScript extends Trait {
|
|||
public function setCanvasVisibility(visible: Bool){
|
||||
for (e in canvas.elements) e.visible = visible;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set dimensions of canvas
|
||||
* @param x Width
|
||||
* @param y Height
|
||||
*/
|
||||
public function setCanvasDimensions(x: Int, y: Int){
|
||||
canvas.width = x;
|
||||
canvas.height = y;
|
||||
}
|
||||
/**
|
||||
* Set font size of the canvas
|
||||
* @param fontSize Size of font to be setted
|
||||
|
|
Loading…
Reference in a new issue