ソースを参照

minor bug fixes

Nicolas Cannasse 10 年 前
コミット
4904079b78
4 ファイル変更9 行追加7 行削除
  1. 2 3
      h2d/CachedBitmap.hx
  2. 1 0
      h2d/RenderContext.hx
  3. 5 3
      samples/filters/Main.hx
  4. 1 1
      samples/shadows/Main.hx

+ 2 - 3
h2d/CachedBitmap.hx

@@ -83,11 +83,11 @@ class CachedBitmap extends Drawable {
 			for( c in childs )
 				syncPosRec(c);
 
-			var prev = ctx.setTarget(tile.getTexture());
+			ctx.pushTarget(tile.getTexture());
 			ctx.engine.clear(0);
 			for( c in childs )
 				c.drawRec(ctx);
-			ctx.setTarget(prev);
+			ctx.popTarget();
 
 			// restore
 			matA = oldA;
@@ -98,7 +98,6 @@ class CachedBitmap extends Drawable {
 			absY = oldY;
 
 			renderDone = true;
-			posChanged = true; // child pos are not up to date
 		}
 
 		draw(ctx);

+ 1 - 0
h2d/RenderContext.hx

@@ -85,6 +85,7 @@ class RenderContext extends h3d.impl.RenderContext {
 	}
 
 	public function popTarget() {
+		flush();
 		begin();
 		var tinf = targetsStack.pop();
 		if( tinf == null ) throw "Too many popTarget()";

+ 5 - 3
samples/filters/Main.hx

@@ -22,12 +22,12 @@ class Main extends hxd.App {
 
 		var help = new h2d.Text(hxd.Res.customFont.toFont(), s2d);
 		help.x = help.y = 5;
-		help.text = "1:Blur 2:Glow 3:DropShadow 4:Displacement 5:Glow(Knockout) 6:Mix +/-:Scale";
+		help.text = "0:Disable 1:Blur 2:Glow 3:DropShadow 4:Displacement 5:Glow(Knockout) 6:Mix +/-:Scale";
 	}
 
 	override function update(dt:Float) {
-		for( i in 1...7 )
-			if( K.isPressed(K.NUMBER_0 + i) )
+		for( i in 0...7 )
+			if( K.isPressed(K.NUMBER_0 + i) || K.isPressed(K.NUMPAD_0+i) )
 				setFilters(i);
 		if( K.isPressed(K.NUMPAD_ADD) ) {
 			spr.scale(1.25);
@@ -48,6 +48,8 @@ class Main extends hxd.App {
 
 	function setFilters(i) {
 		switch( i ) {
+		case 0:
+			spr.filters = [];
 		case 1:
 			spr.filters = [new h2d.filter.Blur(2, 1, 100)];
 		case 2:

+ 1 - 1
samples/shadows/Main.hx

@@ -37,7 +37,7 @@ class Main extends hxd.App {
 
 		shadow = cast(s3d.renderer.getPass("shadow"), h3d.pass.ShadowMap);
 		shadow.lightDirection = dir.direction;
-		shadow.blur.count = 3;
+		shadow.blur.passes = 3;
 	}
 
 	override function update( dt : Float ) {