stage.Add( mTextLabel );
// Respond to a click anywhere on the stage
- stage.GetRootLayer().TouchedSignal().Connect( this, &TiltController::OnTouch );
+ stage.GetRootLayer().TouchSignal().Connect( this, &TiltController::OnTouch );
CreateSensor();
+
+ // Connect signals to allow Back and Escape to exit.
+ stage.KeyEventSignal().Connect( this, &TiltController::OnKeyEvent );
}
void CreateSensor()
}
}
- bool OnTouch( Actor actor, const TouchEvent& touch )
+ bool OnTouch( Actor actor, const TouchData& touch )
{
// quit the application
mApplication.Quit();
mTextLabel.RotateBy(pitchRot);;
}
+ /**
+ * @brief OnKeyEvent signal handler.
+ * @param[in] event The key event information
+ */
+ void OnKeyEvent( const KeyEvent& event )
+ {
+ if( event.state == KeyEvent::Down )
+ {
+ if ( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
+ {
+ mApplication.Quit();
+ }
+ }
+ }
+
private:
Application& mApplication;
TiltSensor mTiltSensor;
// Entry point for Linux & Tizen applications
//
-int main( int argc, char **argv )
+int DALI_EXPORT_API main( int argc, char **argv )
{
Application application = Application::New( &argc, &argv );
TiltController test( application );