- Console.WriteLine( "Text label new point size: " + text.PointSize );
-
- using (RectInteger ri = new RectInteger(02,05,20,30))
- {
- Console.WriteLine( " Created " + ri );
- Console.WriteLine( " IsEmpty() = " + ri.IsEmpty() );
- Console.WriteLine( " Left = " + ri.Left() );
- Console.WriteLine( " Right = " + ri.Right() );
- Console.WriteLine( " Top = " + ri.Top() );
- Console.WriteLine( " Bottom = " + ri.Bottom() );
- Console.WriteLine( " Area = " + ri.Area() );
- }
- Console.WriteLine( " *************************" );
- using (RectInteger ri2 = new RectInteger(02,05,20,30))
- {
- Console.WriteLine( " Created " + ri2 );
- ri2.Set(1,1,40,40);
- Console.WriteLine( " IsEmpty() = " + ri2.IsEmpty() );
- Console.WriteLine( " Left = " + ri2.Left() );
- Console.WriteLine( " Right = " + ri2.Right() );
- Console.WriteLine( " Top = " + ri2.Top() );
- Console.WriteLine( " Bottom = " + ri2.Bottom() );
- Console.WriteLine( " Area = " + ri2.Area() );
- }
- Console.WriteLine( " *************************" );
- using (RectDouble rd = new RectDouble(02,05,20.5,30.5))
- {
- Console.WriteLine( " Created " + rd );
- Console.WriteLine( " IsEmpty() = " + rd.IsEmpty() );
- Console.WriteLine( " Left = " + rd.Left() );
- Console.WriteLine( " Right = " + rd.Right() );
- Console.WriteLine( " Top = " + rd.Top() );
- Console.WriteLine( " Bottom = " + rd.Bottom() );
- Console.WriteLine( " Area = " + rd.Area() );
- }
- Console.WriteLine( " *************************" );
- RectDouble rd2 = new RectDouble();
- rd2.x = 10;
- rd2.y = 10;
- rd2.width = 20;
- rd2.height = 20;
- Console.WriteLine( " Created " + rd2 );
- Console.WriteLine( " IsEmpty() = " + rd2.IsEmpty() );
- Console.WriteLine( " Left = " + rd2.Left() );
- Console.WriteLine( " Right = " + rd2.Right() );
- Console.WriteLine( " Top = " + rd2.Top() );
- Console.WriteLine( " Bottom = " + rd2.Bottom() );
- Console.WriteLine( " Area = " + rd2.Area() );
-
- Console.WriteLine( " *************************" );
- Vector2 vector2 = new Vector2(100, 50);
- Console.WriteLine( " Created " + vector2 );
- Console.WriteLine( " Vector2 x = " + vector2.x + ", y = " + vector2.y );
- vector2 += new Vector2(20, 20);
- Console.WriteLine( " Vector2 x = " + vector2[0] + ", y = " + vector2[1] );
- vector2.x += 10;
- vector2.y += 10;
- Console.WriteLine( " Vector2 width = " + vector2.width + ", height = " + vector2.height );
- vector2 += new Vector2(15, 15);
- Console.WriteLine( " Vector2 width = " + vector2[0] + ", height = " + vector2[1] );
-
- Console.WriteLine( " *************************" );
- Vector3 vector3 = new Vector3(20, 100, 50);
- Console.WriteLine( " Created " + vector3 );
- Console.WriteLine( " Vector3 x = " + vector3.x + ", y = " + vector3.y + ", z = " + vector3.z );
- vector3 += new Vector3(20, 20, 20);
- Console.WriteLine( " Vector3 x = " + vector3[0] + ", y = " + vector3[1] + ", z = " + vector3[2] );
- vector3.x += 10;
- vector3.y += 10;
- vector3.z += 10;
- Console.WriteLine( " Vector3 width = " + vector3.width + ", height = " + vector3.height + ", depth = " + vector3.depth );
- Vector3 parentOrigin = NDalic.ParentOriginBottomRight;
- Console.WriteLine( " parentOrigin x = " + parentOrigin.x + ", y = " + parentOrigin.y + ", z = " + parentOrigin.z );
-
- Console.WriteLine( " *************************" );
- Vector4 vector4 = new Vector4(20, 100, 50, 200);
- Console.WriteLine( " Created " + vector4 );
- Console.WriteLine( " Vector4 x = " + vector4.x + ", y = " + vector4.y + ", z = " + vector4.z + ", w = " + vector4.w );
- vector4 += new Vector4(20, 20, 20, 20);
- Console.WriteLine( " Vector4 x = " + vector4[0] + ", y = " + vector4[1] + ", z = " + vector4[2] + ", w = " + vector4[3] );
- vector4.x += 10;
- vector4.y += 10;
- vector4.z += 10;
- vector4.w += 10;
- Console.WriteLine( " Vector4 r = " + vector4.r + ", g = " + vector4.g + ", b = " + vector4.b + ", a = " + vector4.a );
+ Console.WriteLine("Text label new point size: " + text.PointSize);
+
+ Console.WriteLine("### [4] ActorHandleTest END");
+
+ }
+
+
+
+ public void RectanglePaddingClassTest()
+ {
+ Console.WriteLine("");
+ Console.WriteLine("### [5] RectanglePaddingClassTest START");
+
+ using (Rectangle r1 = new Rectangle(2, 5, 20, 30))
+ {
+ Console.WriteLine(" Created " + r1);
+ Console.WriteLine(" IsEmpty() = " + r1.IsEmpty());
+ Console.WriteLine(" Left = " + r1.Left());
+ Console.WriteLine(" Right = " + r1.Right());
+ Console.WriteLine(" Top = " + r1.Top());
+ Console.WriteLine(" Bottom = " + r1.Bottom());
+ Console.WriteLine(" Area = " + r1.Area());
+ }
+
+ Console.WriteLine(" *************************");
+
+ using (Rectangle r2 = new Rectangle(2, 5, 20, 30))
+ {
+ Console.WriteLine(" Created " + r2);
+ r2.Set(1, 1, 40, 40);
+ Console.WriteLine(" IsEmpty() = " + r2.IsEmpty());
+ Console.WriteLine(" Left = " + r2.Left());
+ Console.WriteLine(" Right = " + r2.Right());
+ Console.WriteLine(" Top = " + r2.Top());
+ Console.WriteLine(" Bottom = " + r2.Bottom());
+ Console.WriteLine(" Area = " + r2.Area());
+ }
+
+ Console.WriteLine(" *************************");
+
+ Rectangle r3 = new Rectangle(10, 10, 20, 20);
+ Rectangle r4 = new Rectangle(10, 10, 20, 20);
+
+ if (r3 == r4)
+ {
+ Console.WriteLine("r3 == r4");
+ }
+ else
+ {
+ Console.WriteLine("r3 != r4");
+ }
+
+ r4 = new Rectangle(12, 10, 20, 20);
+
+ if (r3 == r4)
+ {
+ Console.WriteLine("r3 == r4");
+ }
+ else
+ {
+ Console.WriteLine("r3 != r4");
+ }
+
+ PaddingType p1 = new PaddingType(10.5f, 10.7f, 20.8f, 20.8f);
+ PaddingType p2 = new PaddingType(10.5f, 10.7f, 20.8f, 20.8f);
+
+ if (p1 == p2)
+ {
+ Console.WriteLine("p1 == p2");
+ }
+ else
+ {
+ Console.WriteLine("p1 != p2");
+ }
+
+ p2 = new PaddingType(12.0f, 10.7f, 20.2f, 20.0f);
+
+ if (p1 == p2)
+ {
+ Console.WriteLine("p1 == p2");
+ }
+ else
+ {
+ Console.WriteLine("p1 != p2");
+ }
+ Console.WriteLine("### [5] RectanglePaddingClassTest END");
+
+ }
+
+
+ public void SizePositionTest()
+ {
+ Console.WriteLine("");
+ Console.WriteLine("### [6] SizePositionTest START");
+
+ Size Size = new Size(100, 50, 25);
+ Console.WriteLine(" Created " + Size);
+ Console.WriteLine(" Size w = " + Size.Width + ", h = " + Size.Height + ", d = " + Size.Depth);
+ Size += new Size(20, 20, 20);
+ Console.WriteLine(" Size w = " + Size.Width + ", h = " + Size.Height + ", d = " + Size.Depth);
+ Size.Width += 10;
+ Size.Height += 10;
+ Size.Depth += 10;
+ Console.WriteLine(" Size width = " + Size.Width+ ", height = " + Size.Height + ", depth = " + Size.Depth);
+
+ Console.WriteLine(" *************************");
+ Position Position = new Position(20, 100, 50);
+ Console.WriteLine(" Created " + Position);
+ Console.WriteLine(" Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z);
+ Position += new Position(20, 20, 20);
+ Console.WriteLine(" Position x = " + Position.X + ", y = " + Position.Y + ", z = " + Position.Z);
+ Position.X += 10;
+ Position.Y += 10;
+ Position.Z += 10;
+ Console.WriteLine(" Position width = " + Position.X + ", height = " + Position.Y + ", depth = " + Position.Z);
+ Position parentOrigin = ParentOrigin.BottomRight;
+ Console.WriteLine(" parentOrigin x = " + parentOrigin.X + ", y = " + parentOrigin.Y + ", z = " + parentOrigin.Z);
+
+ Console.WriteLine(" *************************");
+ Color color = new Color(20, 100, 50, 200);
+ Console.WriteLine(" Created " + color);
+ Console.WriteLine(" Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A);
+ color += new Color(20, 20, 20, 20);
+ Console.WriteLine(" Color R = " + color.R + ", G = " + color.G + ", B = " + color.B + ", A = " + color.A);
+ color.R += 10;
+ color.G += 10;
+ color.B += 10;
+ color.A += 10;
+ Console.WriteLine(" Color r = " + color.R + ", g = " + color.G + ", b = " + color.B + ", a = " + color.A);
+
+ Console.WriteLine("### [6] SizePositionTest END");
+ }
+
+
+ public void ViewDownCastTest()
+ {
+ Console.WriteLine("");
+ Console.WriteLine("### [7] ViewDownCastTest START");
+
+ View container = new View();
+ container.Position = new Position(-800.0f, -800.0f, 0.0f);
+ Stage.GetCurrent().Add(container);
+
+ // Test downcast for native control
+ TextLabel myLabel = new TextLabel();
+ myLabel.Name = "MyLabelName";
+ myLabel.Text = "MyText";
+
+ Console.WriteLine("myLabel.Name = " + myLabel.Name + ", Text = " + myLabel.Text);
+
+ container.Add(myLabel);
+
+ Actor myLabelActor = container.FindChildByName("MyLabelName");
+ if (myLabelActor)
+ {
+ TextLabel newLabel = View.DownCast<TextLabel>(myLabelActor);
+ if (newLabel)
+ {
+ Console.WriteLine("Downcast to TextLabel successful: newLabel Name = " + newLabel.Name + ", Text = " + newLabel.Text);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to TextLabel failed!");
+ }
+ }
+
+ // Test downcast for class directly inherited from View
+ MyView myView = new MyView();
+ myView.Name = "MyViewName";
+ myView.MyOwnName = "MyOwnViewName";
+ myView._myCurrentValue = 5;
+
+ Console.WriteLine("myView.Name = " + myView.Name + ", MyOwnName = " + myView.MyOwnName + ", myCurrentValue = " + myView._myCurrentValue);
+
+ container.Add(myView);
+
+ Actor myViewActor = container.FindChildByName("MyViewName");
+ if (myViewActor)
+ {
+ MyView newView = View.DownCast<MyView>(myViewActor);
+ if (newView)
+ {
+ Console.WriteLine("Downcast to MyView successful: newView Name = " + newView.Name + ", MyOwnName = " + newView.MyOwnName + ", myCurrentValue = " + newView._myCurrentValue);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to MyView failed!");
+ }
+ }
+
+ // Test downcast for class directly inherited from native control
+ MyButton myButton = new MyButton();
+ myButton.Name = "MyButtonName";
+ myButton.MyOwnName = "MyOwnViewName";
+ myButton.LabelText = "MyLabelText";
+ myButton._myCurrentValue = 5;
+
+ Console.WriteLine("myButton.Name = " + myButton.Name + ", MyOwnName = " + myButton.MyOwnName + ", LabelText = " + myButton.LabelText + ", myCurrentValue = " + myButton._myCurrentValue);
+
+ container.Add(myButton);
+
+ Actor myButtonActor = container.FindChildByName("MyButtonName");
+ if (myButtonActor)
+ {
+ MyButton newButton = View.DownCast<MyButton>(myButtonActor);
+ if (newButton)
+ {
+ Console.WriteLine("Downcast to MyButton successful: newButton Name = " + newButton.Name + ", MyOwnName = " + newButton.MyOwnName + ", LabelText = " + myButton.LabelText + ", myCurrentValue = " + newButton._myCurrentValue);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to MyButton failed!");
+ }
+ }
+
+ // Test downcast for a CustomView
+ Spin spin = new Spin();
+ spin.Name = "SpinName";
+ spin.MaxValue = 8888;
+
+ Console.WriteLine("spin.Name = " + spin.Name + ", MaxValue = " + spin.MaxValue);
+
+ container.Add(spin);
+
+ Actor spinActor = container.FindChildByName("SpinName");
+ if (spinActor)
+ {
+ Spin newSpin = View.DownCast<Spin>(spinActor);
+ if (newSpin)
+ {
+ Console.WriteLine("Downcast to Spin successful: newSpin Name = " + newSpin.Name + ", MaxValue = " + newSpin.MaxValue);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to Spin failed!");
+ }
+ }
+
+ // Test downcast for class inherited from a CustomView
+ MySpin mySpin = new MySpin();
+ mySpin.Name = "MySpinName";
+ mySpin.MyOwnName = "MyOwnSpinName";
+ mySpin.MaxValue = 8888;
+ mySpin._myCurrentValue = 5;
+
+ Console.WriteLine("mySpin.Name = " + mySpin.Name + ", MyOwnName = " + mySpin.MyOwnName + ", MaxValue = " + mySpin.MaxValue + ", currentValue = " + mySpin._myCurrentValue);
+
+ container.Add(mySpin);
+
+ Actor mySpinActor = container.FindChildByName("MySpinName");
+ if (mySpinActor)
+ {
+ MySpin newSpin = View.DownCast<MySpin>(mySpinActor);
+ if (newSpin)
+ {
+ Console.WriteLine("Downcast to MySpin successful: newSpin Name = " + newSpin.Name + ", MyOwnName = " + newSpin.MyOwnName + ", MaxValue = " + newSpin.MaxValue + ", currentValue = " + newSpin._myCurrentValue);
+ }
+ else
+ {
+ Console.WriteLine("Downcast to MySpin failed!");
+ }
+ }
+
+ Console.WriteLine("### [7] ViewDownCastTest END");