Wraps Rect<int> in C++. Problem with ints is that an explicit conversion needs to be done in C#
application code which looks bad. Int to float conversion is automatic so will still work.
Made a comment in the property to state that the decimal is ignored and that the float is provided
for convenience only.
Change-Id: I9589999406c01529c7f2463c07930e7d1d1bdca6
%define DALI_RECTANGLE_PROPERTY_PARAM(NameSpace,ClassName)
%typemap(cscode) NameSpace::ClassName %{
%define DALI_RECTANGLE_PROPERTY_PARAM(NameSpace,ClassName)
%typemap(cscode) NameSpace::ClassName %{
+ public Rectangle(float x, float y, float width, float height) : this( (int)x, (int)y, (int)width, (int)height )
+ {
+ }
+
public static bool operator ==(Rectangle a, Rectangle b)
{
// If both are null, or both are same instance, return true.
public static bool operator ==(Rectangle a, Rectangle b)
{
// If both are null, or both are same instance, return true.
- ///< X position of the rectangle
- public int X
+ ///< X position of the rectangle, values after the decimal point are ignored, float type provided for convenience.
+ public float X
- ///< Y position of the rectangle
- public int Y
+ ///< Y position of the rectangle, values after the decimal point are ignored, float type provided for convenience.
+ public float Y
- ///< Width of the rectangle
- public int Width
+ ///< Width of the rectangle, values after the decimal point are ignored, float type provided for convenience.
+ public float Width
+ width = (int)( value );
- ///< Height of the rectangle
- public int Height
+ ///< Height of the rectangle, values after the decimal point are ignored, float type provided for convenience.
+ public float Height
+ height = (int)( value );
Console.WriteLine( " *************************" );
Console.WriteLine( " *************************" );
- using (Rectangle r2 = new Rectangle(2, 5, 20, 30))
+ using (Rectangle r2 = new Rectangle(2, 5, 20.0f, 30.0f))
{
Console.WriteLine( " Created " + r2 );
r2.Set(1,1,40,40);
{
Console.WriteLine( " Created " + r2 );
r2.Set(1,1,40,40);