[Sandy] [sandy] r1170 committed - Updated example1-5 for cpp target. Some minor changes.

codesite-noreply at google.com codesite-noreply at google.com
Wed Mar 17 14:52:10 PDT 2010


Revision: 1170
Author: Andy.onthewings
Date: Wed Mar 17 14:50:54 2010
Log: Updated example1-5 for cpp target. Some minor changes.
http://code.google.com/p/sandy/source/detail?r=1170

Modified:
  /trunk/sandy/haxe/trunk/src/sandy/extrusion/data/Polygon2D.hx
  /trunk/sandy/haxe/trunk/tutos/example01/SimpleBox.hx
  /trunk/sandy/haxe/trunk/tutos/example02/ShadedBox.hx
  /trunk/sandy/haxe/trunk/tutos/example03/ShadedTorus.hx
  /trunk/sandy/haxe/trunk/tutos/example04/Airplane.hx
  /trunk/sandy/haxe/trunk/tutos/example04/ConeHedra.hx
  /trunk/sandy/haxe/trunk/tutos/example04/Forest.hx
  /trunk/sandy/haxe/trunk/tutos/example04/Table.hx
  /trunk/sandy/haxe/trunk/tutos/example05/Room.hx

=======================================
--- /trunk/sandy/haxe/trunk/src/sandy/extrusion/data/Polygon2D.hx	Wed Mar  
17 14:35:44 2010
+++ /trunk/sandy/haxe/trunk/src/sandy/extrusion/data/Polygon2D.hx	Wed Mar  
17 14:50:54 2010
@@ -283,7 +283,7 @@
  				return new Polygon2D (pointsHolder);

  			// lexicographic sort
-			pointsHolder = ArrayUtil.sortOnLite(pointsHolder,["x", "y"],  
Array.NUMERIC);
+			ArrayUtil.sortOnLite(pointsHolder,["x", "y"], Array.NUMERIC);

  			// compute top part of hull
  			topHull.push (0);
=======================================
--- /trunk/sandy/haxe/trunk/tutos/example01/SimpleBox.hx	Fri Dec 26  
16:22:11 2008
+++ /trunk/sandy/haxe/trunk/tutos/example01/SimpleBox.hx	Wed Mar 17  
14:50:54 2010
@@ -43,7 +43,15 @@
  		}

  		static function main() {
+				#if !flash
+				neash.Lib.Init("SimpleBox",400,300);
+				#end
+
  				new SimpleBox();
+
+				#if !flash
+				neash.Lib.Run();
+				#end
  		}
  }

=======================================
--- /trunk/sandy/haxe/trunk/tutos/example02/ShadedBox.hx	Fri Dec 26  
16:22:11 2008
+++ /trunk/sandy/haxe/trunk/tutos/example02/ShadedBox.hx	Wed Mar 17  
14:50:54 2010
@@ -60,7 +60,15 @@
  		}

  		static function main() {
+				#if !flash
+				neash.Lib.Init("ShadedBox",400,300);
+				#end
+
  				new ShadedBox();
+
+				#if !flash
+				neash.Lib.Run();
+				#end
  		}
  }

=======================================
--- /trunk/sandy/haxe/trunk/tutos/example03/ShadedTorus.hx	Wed Mar  4  
00:08:12 2009
+++ /trunk/sandy/haxe/trunk/tutos/example03/ShadedTorus.hx	Wed Mar 17  
14:50:54 2010
@@ -14,6 +14,7 @@
  import flash.events.Event;
  import flash.events.KeyboardEvent;
  import flash.Lib;
+import flash.ui.Keyboard;

  class ShadedTorus extends Sprite {
  		var scene:Scene3D;
@@ -72,25 +73,33 @@

  		function keyPressed( event:KeyboardEvent ):Void {
  				switch( event.keyCode ) {
-						case 38:
+						case Keyboard.UP:
  								camera.tilt += 2;
-						case 40:
+						case Keyboard.DOWN:
  								camera.tilt -= 2;
-						case 39:
+						case Keyboard.RIGHT:
  								camera.pan -= 2;
-						case 37:
+						case Keyboard.LEFT:
  								camera.pan += 2;
-						case 17:
+						case Keyboard.CONTROL:
  								camera.roll += 2;
-						case 34:
+						case Keyboard.PAGE_DOWN:
  								camera.z -= 5;
-						case 33:
+						case Keyboard.PAGE_UP:
  								camera.z += 5;
  				}
  		}

  		static function main() {
+				#if !flash
+				neash.Lib.Init("ShadedTorus",400,300);
+				#end
+
  				new ShadedTorus();
+
+				#if !flash
+				neash.Lib.Run();
+				#end
  		}
  }

=======================================
--- /trunk/sandy/haxe/trunk/tutos/example04/Airplane.hx	Fri Dec 26 16:22:11  
2008
+++ /trunk/sandy/haxe/trunk/tutos/example04/Airplane.hx	Wed Mar 17 14:50:54  
2010
@@ -11,6 +11,7 @@
  import flash.events.KeyboardEvent;
  import flash.net.URLRequest;
  import flash.Lib;
+import flash.ui.Keyboard;

  class Airplane extends Sprite {
  		var scene:Scene3D;
@@ -71,12 +72,20 @@
  		}

  		function keyPressedHandler( event:KeyboardEvent ):Void {
-				if ( event.keyCode == 39 ) s.rotateY -= 5; // KEY_RIGHT
-				if ( event.keyCode == 37 ) s.rotateY += 5; // KEY_LEFT
+				if ( event.keyCode == Keyboard.RIGHT ) s.rotateY -= 5; // KEY_RIGHT
+				if ( event.keyCode == Keyboard.LEFT ) s.rotateY += 5; // KEY_LEFT
  		}

  		static function main() {
+				#if !flash
+				neash.Lib.Init("Airplane",400,300);
+				#end
+
  				new Airplane();
+
+				#if !flash
+				neash.Lib.Run();
+				#end
  		}
  }

=======================================
--- /trunk/sandy/haxe/trunk/tutos/example04/ConeHedra.hx	Wed Mar  4  
00:08:12 2009
+++ /trunk/sandy/haxe/trunk/tutos/example04/ConeHedra.hx	Wed Mar 17  
14:50:54 2010
@@ -16,6 +16,7 @@
  import flash.events.Event;
  import flash.events.KeyboardEvent;
  import flash.Lib;
+import flash.ui.Keyboard;

  class ConeHedra extends Sprite {
  		var scene:Scene3D;
@@ -90,19 +91,27 @@

  		function keyPressed( event:KeyboardEvent ):Void {
  				switch( event.keyCode ) {
-						case 38: // KEY_UP
+						case Keyboard.UP: // KEY_UP
  								tg.y += 2;
-						case 40: // KEY_DOWN
+						case Keyboard.DOWN: // KEY_DOWN
  								tg.y -= 2;
-						case 39: // KEY_RIGHT
+						case Keyboard.RIGHT: // KEY_RIGHT
  								tg.roll += 2;
-						case 37: // KEY_LEFT
+						case Keyboard.LEFT: // KEY_LEFT
  								tg.roll -= 2;
  				}
  		}

  		static function main() {
+				#if !flash
+				neash.Lib.Init("ConeHedra",400,300);
+				#end
+
  				new ConeHedra();
+
+				#if !flash
+				neash.Lib.Run();
+				#end
  		}
  }

=======================================
--- /trunk/sandy/haxe/trunk/tutos/example04/Forest.hx	Fri Dec 26 16:22:11  
2008
+++ /trunk/sandy/haxe/trunk/tutos/example04/Forest.hx	Wed Mar 17 14:50:54  
2010
@@ -13,6 +13,7 @@
  import flash.events.MouseEvent;
  import flash.net.URLRequest;
  import flash.Lib;
+import flash.ui.Keyboard;

  class Forest extends Sprite {
  		var scene:Scene3D;
@@ -57,7 +58,8 @@

  						var tree:DisplayObject = queue.data.get( "tree" );
  						if ( Reflect.hasField( tree, "bitmapData" ) ) {
-								var bit:Bitmap = new Bitmap( Reflect.field( tree, "bitmapData" ) );
+								var bd = Reflect.field( tree, "bitmapData" );
+								var bit:Bitmap = new Bitmap( bd );
  								var s:Sprite2D = new Sprite2D( "tree"+i, bit, 1 );
  								s.x = Math.random() * 600 - 300;
  								s.z = Math.random() * 600;
@@ -75,9 +77,9 @@

  		function keyPressedHandler( event:KeyboardEvent ):Void {
  				switch( event.keyCode ) {
-						case 38: // KEY_UP
+						case Keyboard.UP: // KEY_UP
  								camera.moveForward(5);
-						case 40: // KEY_DOWN
+						case Keyboard.DOWN: // KEY_DOWN
  								camera.moveForward(-5);
  				}
  		}
@@ -88,7 +90,15 @@
  		}

  		static function main() {
+				#if !flash
+				neash.Lib.Init("Forest",400,300);
+				#end
+
  				new Forest();
+
+				#if !flash
+				neash.Lib.Run();
+				#end
  		}
  }

=======================================
--- /trunk/sandy/haxe/trunk/tutos/example04/Table.hx	Sat Mar  7 11:07:26  
2009
+++ /trunk/sandy/haxe/trunk/tutos/example04/Table.hx	Wed Mar 17 14:50:54  
2010
@@ -18,6 +18,7 @@
  import flash.events.Event;
  import flash.events.KeyboardEvent;
  import flash.Lib;
+import flash.ui.Keyboard;

  class Table extends Sprite {
  		var scene:Scene3D;
@@ -143,20 +144,20 @@

  		function keyPressed( event:KeyboardEvent ):Void {
  				switch( event.keyCode ) {
-						case 34: // PAGE_DOWN
+						case Keyboard.PAGE_DOWN: // PAGE_DOWN
  								scene.light.setPower( scene.light.getPower() - 5 );
-						case 33: // PAGE_UP
+						case Keyboard.PAGE_UP: // PAGE_UP
  								scene.light.setPower( scene.light.getPower() + 5 );
-						case 38: // KEY_UP
+						case Keyboard.UP: // KEY_UP
  								lightY += 10;
  								scene.light.setDirection( lightX, lightY, lightZ );
-						case 40: // KEY_DOWN
+						case Keyboard.DOWN: // KEY_DOWN
  								lightY -= 10;
  								scene.light.setDirection( lightX, lightY, lightZ );
-						case 39: // KEY_RIGHT
+						case Keyboard.RIGHT: // KEY_RIGHT
  								lightX += 10;
  								scene.light.setDirection( lightX, lightY, lightZ );
-						case 37: // KEY_LEFT
+						case Keyboard.LEFT: // KEY_LEFT
  								lightX -= 10;
  								scene.light.setDirection( lightX, lightY, lightZ );
  				}
@@ -164,7 +165,15 @@
  		}

  		static function main() {
+				#if !flash
+				neash.Lib.Init("Table",400,300);
+				#end
+
  				new Table();
+
+				#if !flash
+				neash.Lib.Run();
+				#end
  		}
  }

=======================================
--- /trunk/sandy/haxe/trunk/tutos/example05/Room.hx	Fri Dec 26 16:22:11 2008
+++ /trunk/sandy/haxe/trunk/tutos/example05/Room.hx	Wed Mar 17 14:50:54 2010
@@ -105,19 +105,27 @@

  		function keyPressed( event:KeyboardEvent ):Void {
  				switch( event.keyCode ) {
-						case 38: // KEY_UP
+						case flash.ui.Keyboard.UP: // KEY_UP
  								tg.tilt += 2;
-						case 40: // KEY_DOWN
+						case flash.ui.Keyboard.DOWN: // KEY_DOWN
  								tg.tilt -= 2;
-						case 39: // KEY_RIGHT
+						case flash.ui.Keyboard.RIGHT: // KEY_RIGHT
  								tg.tilt += 2;
-						case 37: // KEY_LEFT
+						case flash.ui.Keyboard.LEFT: // KEY_LEFT
  								tg.tilt -= 2;
  				}
  		}

  		static function main() {
+				#if !flash
+				neash.Lib.Init("Room",400,300);
+				#end
+
  				new Room();
+
+				#if !flash
+				neash.Lib.Run();
+				#end
  		}
  }




More information about the Sandy mailing list