浏览代码

add more to the bound samples

[email protected] 11 年之前
父节点
当前提交
9ad9b2ce59
共有 3 个文件被更改,包括 31 次插入7 次删除
  1. 24 2
      samples/bounds/Bounds.hx
  2. 4 2
      samples/bounds/bounds.hxml
  3. 3 3
      samples/bounds/bounds.hxproj

+ 24 - 2
samples/bounds/Bounds.hx

@@ -7,6 +7,7 @@ class Bounds extends hxd.App {
 
 	override function init() {
 		boxes = [];
+		
 		g = new h2d.Graphics(s2d);
 		for( i in 0...colors.length ) {
 			var size = Std.int(200 / (i + 4));
@@ -14,8 +15,8 @@ class Bounds extends hxd.App {
 			var b = new h2d.Bitmap(h2d.Tile.fromColor(c | 0x80000000, size, size).sub(0, 0, size, size, -Std.random(size), -Std.random(size)), i == 0 ? s2d : boxes[i - 1]);
 			b.addChild(new h2d.Bitmap(h2d.Tile.fromColor(0xFFFFFFFF, 8, 8).sub(0, 0, 8, 8, -4, -4)));
 			if( i == 0 ) {
-				b.x = s2d.width >> 1;
-				b.y = s2d.height >> 1;
+				b.x = s2d.width * 0.5;
+				b.y = s2d.height * 0.5;
 			} else {
 				b.x = Std.random(50) - 25;
 				b.y = Std.random(50) - 25;
@@ -32,6 +33,27 @@ class Bounds extends hxd.App {
 		tf.x = -5;
 		tf.y = 15;
 		tf.filter = true;
+		
+		
+		
+		var g = new h2d.Bitmap( h2d.Tile.fromColor(0xFFFF0000,32, 32), s2d);
+		g.x += 32;
+		g.y += 32;
+		trace(g.getBounds(g.parent).width);
+		g.scaleX = 2.0;
+		trace(g.getBounds(g.parent).width);
+		
+		
+		var g =  new h2d.Graphics(s2d );
+		g.drawRect(0, 0, 32, 32);
+		g.x += 32;
+		g.y += 32;
+		trace(g.getBounds(g.parent).width);
+		g.scaleX = 2.0;
+		trace(g.getBounds(g.parent).width);
+		
+		g.scaleY = 3.0;
+		trace(g.getBounds(g.parent).height);
 	}
 
 	override function update(dt:Float) {

+ 4 - 2
samples/bounds/bounds.hxml

@@ -1,6 +1,8 @@
 -swf bounds.swf
 -swf-header 800:600:60:FFFFFF
 --flash-strict
--swf-version 11
+-swf-version 11.6
 -main Bounds
--lib h3d
+-cp ../..
+-D h3d
+-lib hxsl

+ 3 - 3
samples/bounds/bounds.hxproj

@@ -9,7 +9,7 @@
     <movie width="800" />
     <movie height="600" />
     <movie version="11" />
-    <movie minorVersion="0" />
+    <movie minorVersion="6" />
     <movie platform="Flash Player" />
     <movie background="#FFFFFF" />
   </output>
@@ -23,8 +23,8 @@
     <option flashStrict="True" />
     <option noInlineOnDebug="False" />
     <option mainClass="Bounds" />
-    <option enabledebug="False" />
-    <option additional="-lib h3d" />
+    <option enabledebug="True" />
+    <option additional="-cp ../..&#xA;-D h3d&#xA;-lib hxsl" />
   </build>
   <!-- haxelib libraries -->
   <haxelib>