}
}
- public Vector2 Size
+ public Dali.Size Size
{
get
{
- Vector2 ret = GetSize();
+ Vector2 ret1 = GetSize();
+ Dali.Size ret= new Size(ret1);
return ret;
}
}
- public Vector4 BackgroundColor
+ public Dali.Color BackgroundColor
{
set
{
}
get
{
- Vector4 ret = GetBackgroundColor();
+ Vector4 ret1 = GetBackgroundColor();
+ Dali.Color ret = new Color(ret1);
return ret;
}
}
Console.WriteLine("Actor name: " + actor.Name);
Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = NDalic.WHITE ;
+ stage.BackgroundColor = new Color("white") ;
- Vector2 stageSize = stage.Size;
+ Size stageSize = stage.Size;
Console.WriteLine("Stage size: " + stageSize.x + ", " + stageSize.y);
stage.Add(actor);
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] );
+ Size Size = new Size(100, 50);
+ Console.WriteLine( " Created " + Size );
+ Console.WriteLine( " Size x = " + Size.x + ", y = " + Size.y );
+ Size += new Size(20, 20);
+ Console.WriteLine( " Size x = " + Size[0] + ", y = " + Size[1] );
+ Size.x += 10;
+ Size.y += 10;
+ Console.WriteLine( " Size width = " + Size.width + ", height = " + Size.height );
+ Size += new Size(15, 15);
+ Console.WriteLine( " Size width = " + Size[0] + ", height = " + Size[1] );
Console.WriteLine( " *************************" );
Vector3 vector3 = new Vector3(20, 100, 50);
{
Console.WriteLine("Customized Application Initialize event handler");
Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = NDalic.WHITE;
+ stage.BackgroundColor = new Color("white");
stage.Touched += OnStageTouched;
private void CreateScrollView()
{
Stage stage = Stage.GetCurrent();
- stage.BackgroundColor = NDalic.WHITE;
+ stage.BackgroundColor = new Color("white");
// Create a scroll view
_scrollView = new ScrollView();
- Vector2 stageSize = stage.Size;
- _scrollView.Size = new Vector3(stageSize.x, stageSize.y, 0.0f);
+ Size stageSize = stage.Size;
+ _scrollView.Size = new Position(stageSize.x, stageSize.y, 0.0f);
_scrollView.ParentOrigin = NDalic.ParentOriginCenter;
_scrollView.AnchorPoint = NDalic.AnchorPointCenter;
stage.Add(_scrollView);
pageActor.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.ALL_DIMENSIONS);
pageActor.ParentOrigin = NDalic.ParentOriginCenter;
pageActor.AnchorPoint = NDalic.AnchorPointCenter;
- pageActor.Position = new Vector3(pageColumn * stageSize.x, pageRow * stageSize.y, 0.0f);
+ pageActor.Position = new Position(pageColumn * stageSize.x, pageRow * stageSize.y, 0.0f);
// Add images in a 3x4 grid layout for each page
int imageRows = 4;
int imageColumns = 3;
float margin = 10.0f;
- Vector3 imageSize = new Vector3((stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0f);
+ Position imageSize = new Position((stageSize.x / imageColumns) - margin, (stageSize.y / imageRows) - margin, 0.0f);
for(int row = 0; row < imageRows; row++)
{
imageView.ParentOrigin = NDalic.ParentOriginCenter;
imageView.AnchorPoint = NDalic.AnchorPointCenter;
imageView.Size = imageSize;
- imageView.Position = new Vector3( margin * 0.5f + (imageSize.x + margin) * column - stageSize.x * 0.5f + imageSize.x * 0.5f,
+ imageView.Position = new Position( margin * 0.5f + (imageSize.x + margin) * column - stageSize.x * 0.5f + imageSize.x * 0.5f,
margin * 0.5f + (imageSize.y + margin) * row - stageSize.y * 0.5f + imageSize.y * 0.5f, 0.0f );
pageActor.Add(imageView);
}
_scrollBar.AnchorPoint = NDalic.AnchorPointTopLeft;
_scrollBar.SetResizePolicy(ResizePolicyType.FIT_TO_CHILDREN, DimensionType.WIDTH);
_scrollBar.SetResizePolicy(ResizePolicyType.FILL_TO_PARENT, DimensionType.HEIGHT);
- _scrollBar.Orientation = new Quaternion( new Radian( new Degree( 270.0f ) ), Vector3.ZAXIS );
+ _scrollBar.Orientation = new Quaternion( new Radian( new Degree( 270.0f ) ), Position.ZAXIS );
_scrollBar.SetScrollDirection(ScrollBar.Direction.Horizontal);
_scrollView.Add(_scrollBar);
_animation = new Animation(1.0f); // 1 second of duration
- _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, 0.5f));
- _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.5f, 0.5f));
+ _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 180.0f ) ), Position.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, 0.5f));
+ _animation.AnimateTo(new Property(_text, Actor.Property.ORIENTATION), new Property.Value(new Quaternion( new Radian( new Degree( 0.0f ) ), Position.XAXIS )), new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.5f, 0.5f));
// Connect the signal callback for animaiton finished signal
_animation.Finished += AnimationFinished;
Console.WriteLine("View OnRelayoutEventArgs EVENT callback....");
// Set the correct scroll bar size after size negotiation of scroll view is done
- _scrollBar.Size = new Vector3(0.0f, _scrollView.GetRelayoutSize(DimensionType.WIDTH), 0.0f);
+ _scrollBar.Size = new Position(0.0f, _scrollView.GetRelayoutSize(DimensionType.WIDTH), 0.0f);
}
public void MainLoop()
--- /dev/null
+namespace Dali {
+
+using System;
+
+public class Color : Vector4
+ {
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ */
+ public Color()
+ : base()
+ { }
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] red The Color r.
+ * @param [in] green The Color g.
+ * @param [in] blue The Color b.
+ * @param [in] alpha The Color a.
+ */
+ public Color(float red, float green, float blue, float alpha)
+ : base(red, green, blue, alpha)
+ { }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] o The Vector Position r, g, b, a.
+ */
+ public Color(Vector4 o)
+ : base(o.x, o.y, o.z, o.w)
+ {
+
+ }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] color as string.
+ */
+ public Color(string color)
+ : base(0, 0, 0, 0)
+ {
+ switch (color)
+ {
+ case "red":
+ SetColor(255, 0, 0, 255);
+ break;
+ case "white":
+ SetColor(255, 255, 255, 255);
+ break;
+ case "blue":
+ SetColor(0, 0, 255, 255);
+ break;
+ case "green":
+ SetColor(0, 255, 0, 255);
+ break;
+ case "black":
+ SetColor(0, 0, 0, 255);
+ break;
+ case "grey":
+ SetColor(128, 128, 128, 255);
+ break;
+ case "yellow":
+ SetColor(255, 255, 0, 255);
+ break;
+ case "azure":
+ SetColor(0, 255, 255, 255);
+ break;
+ case "rose":
+ SetColor(255, 0, 255, 255);
+ break;
+ }
+ }
+
+ /**
+ * @brief SetColor
+ *
+ * @since 1.0.0
+ * @param [in] red The Color r.
+ * @param [in] green The Color g.
+ * @param [in] blue The Color b.
+ * @param [in] alpha The Color a.
+ */
+ public void SetColor(float red, float green, float blue, float alpha)
+ {
+ r = red;
+ g = green;
+ b = blue;
+ a = alpha;
+ }
+
+ ///< name "R", type float (Color R value)
+ //@since 1.0.0
+ public float R
+ {
+ get { return r; }
+ set { r = value; }
+ }
+
+ ///< name "G", type float (Color G value)
+ //@since 1.0.0
+ public float G
+ {
+ get { return g; }
+ set { g = value; }
+ }
+
+ ///< name "B", type float (Color B value)
+ //@since 1.0.0
+ public float B
+ {
+ get { return b; }
+ set { b = value; }
+ }
+
+ ///< name "A", type float (Color A value)
+ //@since 1.0.0
+ public float A
+ {
+ get { return a; }
+ set { a = value; }
+ }
+
+ /**
+ * @brief Equals
+ *
+ * @since 1.0.0
+ * @param [in] o The Color object to compare.
+ * @param [in] r The Color to add
+ * @return bool, whether object equal or not
+ */
+ public override bool Equals(object obj)
+ {
+ Color l = this;
+ Color r = obj as Color;
+ if (r == null)
+ {
+ return false;
+ }
+ return l.R == r.R && l.G == r.G && l.B == r.B && l.A == r.A;
+ }
+
+ /**
+ * @brief GetHashCode
+ *
+ * @since 1.0.0
+ * @return int, hascode of Color
+ */
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ /**
+ * @brief Clone
+ *
+ * @since 1.0.0
+ * @return Color object
+ */
+ public Color Clone()
+ {
+ Color copy = new Color(R, G, B, A);
+ return copy;
+ }
+ }
+
+}
--- /dev/null
+namespace Dali {
+
+using System;
+
+public class Position : Vector3
+ {
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ */
+ public Position()
+ : base()
+ {
+ }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] a The Position X.
+ * @param [in] b The Position Y.
+ * @param [in] c The Position Z.
+ */
+ public Position(float a, float b, float c)
+ : base(a, b, c)
+ {
+ }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] o The Vector Position X, Y, Z.
+ */
+ public Position(Vector3 o)
+ : base(o.x, o.y, o.z)
+ {
+ }
+
+ ///< name "X", type float (Position X value)
+ //@since 1.0.0
+ public float X
+ {
+ get { return width; }
+ set { width = value; }
+ }
+
+ ///< name "Y", type float (Position Y value)
+ //@since 1.0.0
+ public float Y
+ {
+ get { return height; }
+ set { height = value; }
+ }
+
+ ///< name "Z", type float (Position Z value)
+ //@since 1.0.0
+ public float Z
+ {
+ get { return depth; }
+ set { depth = value; }
+ }
+
+ /**
+ * @brief operator+
+ *
+ * @since 1.0.0
+ * @param [in] l The Position to add.
+ * @param [in] r The Position to add
+ * @return A reference to this
+ */
+ public static Position operator +(Position l, Position r)
+ {
+ return new Position(l.X + r.X, l.Y + r.Y, l.Z + r.Z);
+ }
+
+ /**
+ * @brief operator-
+ *
+ * @since 1.0.0
+ * @param [in] l The Position to add.
+ * @param [in] r The Position to add
+ * @return A reference to this
+ */
+ public static Position operator -(Position l, Position r)
+ {
+ return new Position(l.X - r.X, l.Y - r.Y, l.Z - r.Z);
+ }
+
+ /**
+ * @brief operator*
+ *
+ * @since 1.0.0
+ * @param [in] l The Position to add.
+ * @param [in] r The Position to add
+ * @return A reference to this
+ */
+ public static Position operator *(Position a, double b)
+ {
+ return new Position((int)(a.X * b), (int)(a.Y * b), (int)(a.Z * b));
+ }
+
+ /**
+ * @brief operator/
+ *
+ * @since 1.0.0
+ * @param [in] l The Position to add.
+ * @param [in] r The Position to add
+ * @return A reference to this
+ */
+ public static float operator /(Position a, Position b)
+ {
+ return (float)System.Math.Sqrt((a.X / b.X) * (a.Y / b.Y) * (a.Z / b.Z));
+ }
+
+ /**
+ * @brief Equals
+ *
+ * @since 1.0.0
+ * @param [in] o The Position object to compare.
+ * @param [in] r The Position to add
+ * @return bool, whether object equal or not
+ */
+ public override bool Equals(object obj)
+ {
+ Position r = obj as Position;
+ if (r == null)
+ {
+ return false;
+ }
+ return this.X == r.X && this.Y == r.Y && this.Z == r.Z;
+ }
+
+ /**
+ * @brief GetHashCode
+ *
+ * @since 1.0.0
+ * @return int, hascode of position
+ */
+ public override int GetHashCode()
+ {
+ return base.GetHashCode();
+ }
+
+ /**
+ * @brief Clone
+ *
+ * @since 1.0.0
+ * @return Positin object
+ */
+ public Position Clone()
+ {
+ Position copy = new Position(X, Y, Z);
+ return copy;
+ }
+ }
+
+}
--- /dev/null
+namespace Dali {
+
+using System;
+
+public class Size : Vector2
+ {
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] a The Size X.
+ * @param [in] b The Size Y.
+ */
+ public Size(float a, float b)
+ : base(a, b)
+ {
+ }
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ */
+ public Size()
+ : base()
+ {
+ }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] o The Vector Size X, Y.
+ */
+ public Size(Vector2 o)
+ : base(o.x, o.y)
+ {
+
+ }
+
+ /**
+ * @brief constructor
+ *
+ * @since 1.0.0
+ * @param [in] o The Size X, Y.
+ */
+ public Size(Size a)
+ : base(a.width, a.height)
+ {
+ }
+
+ ///< name "W", type float (Size W value)
+ //@since 1.0.0
+ public float W
+ {
+ get { return width; }
+ set { width = value; }
+ }
+
+ ///< name "H", type float (Size W value)
+ //@since 1.0.0
+ public float H
+ {
+ get { return height; }
+ set { height = value; }
+ }
+
+ /**
+ * @brief operator+
+ *
+ * @since 1.0.0
+ * @param [in] l The Size to add.
+ * @param [in] r The Size to add
+ * @return A reference to this
+ */
+ public static Size operator +(Size l, Size r)
+ {
+ return new Size(l.W + r.W, l.H + r.H);
+ }
+
+ /**
+ * @brief operator-
+ *
+ * @since 1.0.0
+ * @param [in] l The Size to add.
+ * @param [in] r The Size to add
+ * @return A reference to this
+ */
+ public static Size operator -(Size l, Size r)
+ {
+ return new Size(l.W - r.W, l.H - r.H);
+ }
+
+ /**
+ * @brief operator*
+ *
+ * @since 1.0.0
+ * @param [in] l The Size to add.
+ * @param [in] r The Size to add
+ * @return A reference to this
+ */
+ public static Size operator *(Size a, double b)
+ {
+ return new Size((int)(a.W * b), (int)(a.H * b));
+ }
+
+ /**
+ * @brief operator/
+ *
+ * @since 1.0.0
+ * @param [in] l The Size to add.
+ * @param [in] r The Size to add
+ * @return A reference to this
+ */
+ public static float operator /(Size a, Size b)
+ {
+ return (float)System.Math.Sqrt((a.W / b.W) * (a.H / b.H));
+ }
+
+ /**
+ * @brief Equals
+ *
+ * @since 1.0.0
+ * @param [in] o The Size object to compare.
+ * @param [in] r The Size to add
+ * @return bool, whether object equal or not
+ */
+ public override bool Equals(object obj)
+ {
+ Size that = obj as Size;
+ if (that == null)
+ {
+ return false;
+ }
+ return this.W == that.W && this.H == that.H;
+ }
+
+ /**
+ * @brief GetHashCode
+ *
+ * @since 1.0.0
+ * @return int, hascode of Size
+ */
+ public override int GetHashCode()
+ {
+ return (int)(W + H);
+ }
+
+ /**
+ * @brief Clone
+ *
+ * @since 1.0.0
+ * @return Size object
+ */
+ public Size Clone()
+ {
+ Size copy = new Size(W, H);
+ return copy;
+ }
+ }
+}