Update CanvasScript.hx

This commit is contained in:
Simonrazer 2020-03-16 09:05:42 +01:00 committed by GitHub
parent 252e0dc7f3
commit 5cde1487ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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