Procházet zdrojové kódy

added backgroundColor (useful for debug purposes)

ncannasse před 12 roky
rodič
revize
c09fa59f80
1 změnil soubory, kde provedl 6 přidání a 1 odebrání
  1. 6 1
      h2d/Interactive.hx

+ 6 - 1
h2d/Interactive.hx

@@ -1,6 +1,6 @@
 package h2d;
 
-class Interactive extends Sprite {
+class Interactive extends Drawable {
 
 	public var width : Float;
 	public var height : Float;
@@ -8,6 +8,7 @@ class Interactive extends Sprite {
 	public var isEllipse : Bool;
 	public var blockEvents : Bool = true;
 	public var propagateEvents : Bool = false;
+	public var backgroundColor : Null<Int>;
 	var scene : Scene;
 	
 	public function new(width, height, ?parent) {
@@ -28,6 +29,10 @@ class Interactive extends Sprite {
 		super.onAlloc();
 	}
 	
+	override function draw( ctx : RenderContext ) {
+		if( backgroundColor != null ) drawTile(ctx.engine,h2d.Tile.fromColor(backgroundColor,Std.int(width),Std.int(height)));
+	}
+	
 	override function onParentChanged() {
 		if( scene != null ) {
 			scene.removeEventTarget(this);