{
class Example
{
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- delegate void CallbackDelegate(IntPtr data);
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- delegate void TouchCallbackDelegate(IntPtr data);
-
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- delegate void AnimationCallbackDelegate(IntPtr data);
-
private Dali.Application _application;
private Animation _animation;
public Example(Dali.Application application)
{
_application = application;
-
- CallbackDelegate initializeCallback = new CallbackDelegate( Initialize );
- _application.InitSignal().Connect( initializeCallback );
+ _application.Initialized += Initialize;
}
- private void Initialize(IntPtr appPtr)
+ public void Initialize(object source, AUIApplicationInitEventArgs e)
{
+ Console.WriteLine("Customized Application Initialize event handler");
Stage stage = Stage.GetCurrent();
- stage.SetBackgroundColor( NDalic.WHITE );
+ stage.BackgroundColor = Color.Green;
- // Connect the signal callback for stage touched signal
- TouchCallbackDelegate stageTouchedCallback = new TouchCallbackDelegate( OnStageTouched );
- stage.TouchSignal().Connect( stageTouchedCallback );
+ stage.Touched += OnStageTouched;
// Add a _text label to the stage
_text = new TextLabel("Hello Mono World");
}
// Callback for _animation finished signal handling
- private void AnimationFinished(IntPtr data)
+ public void AnimationFinished(object source, Animation.FinishedEventArgs e)
{
- Animation _animation = Animation.GetAnimationFromPtr( data );
- Console.WriteLine("Animation finished: duration = " + _animation.GetDuration());
+ Console.WriteLine("Customized Animation Finished Event handler");
+ Console.WriteLine("Animation finished: duration = " + e.Animation.Duration);
+ Console.WriteLine("End Action = " + e.Animation.GetEndAction());
}
// Callback for stage touched signal handling
- private void OnStageTouched(IntPtr data)
+ public void OnStageTouched(object source, Stage.TouchEventArgs e)
{
- TouchData touchData = TouchData.GetTouchDataFromPtr( data );
+ //TouchData touchData = TouchData.GetTouchDataFromPtr( data );
// Only animate the _text label when touch down happens
- if( touchData.GetState(0) == PointStateType.DOWN )
+ if( e.TouchData.GetState(0) == PointStateType.DOWN )
{
+ Console.WriteLine("Customized Stage Touch event handler");
// Create a new _animation
if( _animation )
{
_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(_text, Animation.Orientation, new Quaternion( new Radian( new Degree( 180.0f ) ), Vector3.XAXIS ), new AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.0f, 0.5f));
+
+ _animation.AnimateTo(_text, Animation.Orientation, new Quaternion( new Radian( new Degree( 0.0f ) ), Vector3.XAXIS ), new AlphaFunction(Dali.Constants.AlphaFunction.BuiltinFunction.Linear), new TimePeriod(0.5f, 0.5f));
// Connect the signal callback for animaiton finished signal
- AnimationCallbackDelegate animFinishedDelegate = new AnimationCallbackDelegate( AnimationFinished );
- _animation.FinishedSignal().Connect( animFinishedDelegate );
+ _animation.Finished += AnimationFinished;
// Play the _animation
_animation.Play();
+
+ Console.WriteLine("Looping:" + _animation.Looping);
}
}