Dali 3D User Interface Engine
Hello World - explained

The following steps are required for displaying the sentence 'Hello World' with Dali:

To understand the basic building blocks of the UI make sure to read the chapter on DALi Fundamentals first.

Let's take a look at the code for this test application.

Example code

using namespace Dali;
// This example shows how to create and display Hello World! using a simple TextActor
class HelloWorldController : public ConnectionTracker
HelloWorldController( Application& application )
: mApplication( application )
// Connect to the Application's Init signal
mApplication.InitSignal().Connect( this, &HelloWorldController::Create );
// Remove Hello World actor from stage
// The Init signal is received once (only) during the Application lifetime
void Create( Application& application )
// Get a handle to the stage
mTextLabel = TextLabel::New( "Hello World" );
mTextLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
stage.Add( mTextLabel );
// Respond to a click anywhere on the stage
stage.GetRootLayer().TouchedSignal().Connect( this, &HelloWorldController::OnTouch );
bool OnTouch( Actor actor, const TouchEvent& touch )
// quit the application
return true;
Application& mApplication;
TextLabel mTextLabel;
void RunTest( Application& application )
HelloWorldController test( application );
// Entry point for Linux & Tizen applications
int main( int argc, char **argv )
Application application = Application::New( &argc, &argv );
RunTest( application );
return 0;

There are a couple of steps which are very important to understand.

Initializing DALi

The application should not use the DALi library until it has sent the init complete signal! That's why we connect our ExampleApp::Create callback to Dali::Application's SignalInit signal:

app.SignalInit().Connect(this, &ExampleApp::Create);

Reference counting

The application should store Actors' and resources' handles. DALi objects are reference counted, which makes sure they exist only as long as they are needed. That's why we store the Actor's handle:

mTextLabel = TextLabel::New("Hello World");

Even if the TextLabel is removed from the stage, it will be kept alive through our reference.
You can read more about implicit smart-pointer semantics in chapter Handle – body.

Main loop

To 'run' the application, it's main loop should be started. This ensures that images are displayed, events, signals are dispatched and captured and so on.


On X11 platform you can compile the above example with:

g++ `pkg-config --libs --cflags dali` hello-dali.cpp -o hello

After running './hello' this should be visible on the screen:

Hello world example
Dali Docs Home
Read more about Dali