I added a button to my game and the button is an h2d.Interactive instance. It works good for now but unfortunately the button doesn’t get drawn. It says in the code, that backgroundColor
can be defined so a tile gets drawn.
public var backgroundColor
: “If set, Interactive will draw aTile
with[width, height]
dimensions of specified color (including alpha).”
Is it maybe that I missed a step, maybe I have to call
override function draw( ctx : RenderContext )
?
Or the instance must be child of a h2d.Flow
?
Thank you.
my code
var w : Float = 128;
var h : Float = 64;
var button = new Interactive( w, h, s2d );
button.backgroundColor = 0x66ff99;
button.alpha = 1;
button.visible = true;
button.setPosition( s2d.width-(2*w), 2 );
// some label for the button
var t = new h2d.Text(hxd.res.DefaultFont.get());
t.text = "click me";
t.textColor = 0xFFFFFF;
button.addChild( t );