Commit bfff4869437f666a1e656433bde3350a83173df9
1 parent
73160555
Fixed the Hello World example
Change-Id: I05e4ec4191816dc247d6536d4c85b3dbe43599ef
Showing
1 changed file
with
12 additions
and
5 deletions
examples/hello-world/hello-world-example.cpp
| ... | ... | @@ -15,10 +15,10 @@ |
| 15 | 15 | * |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -#include <dali/dali.h> | |
| 19 | -#include <iostream> | |
| 18 | +#include <dali-toolkit/dali-toolkit.h> | |
| 20 | 19 | |
| 21 | 20 | using namespace Dali; |
| 21 | +using Dali::Toolkit::TextLabel; | |
| 22 | 22 | |
| 23 | 23 | // This example shows how to create and display Hello World! using a simple TextActor |
| 24 | 24 | // |
| ... | ... | @@ -29,8 +29,6 @@ public: |
| 29 | 29 | HelloWorldController( Application& application ) |
| 30 | 30 | : mApplication( application ) |
| 31 | 31 | { |
| 32 | - std::cout << "HelloWorldController::HelloWorldController" << std::endl; | |
| 33 | - | |
| 34 | 32 | // Connect to the Application's Init signal |
| 35 | 33 | mApplication.InitSignal().Connect( this, &HelloWorldController::Create ); |
| 36 | 34 | } |
| ... | ... | @@ -43,7 +41,16 @@ public: |
| 43 | 41 | // The Init signal is received once (only) during the Application lifetime |
| 44 | 42 | void Create( Application& application ) |
| 45 | 43 | { |
| 46 | - // TODO | |
| 44 | + // Get a handle to the stage | |
| 45 | + Stage stage = Stage::GetCurrent(); | |
| 46 | + | |
| 47 | + TextLabel textLabel = TextLabel::New(); | |
| 48 | + textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); | |
| 49 | + textLabel.SetProperty( TextLabel::Property::TEXT, "Hello World" ); | |
| 50 | + stage.Add( textLabel ); | |
| 51 | + | |
| 52 | + // Respond to a click anywhere on the stage | |
| 53 | + stage.GetRootLayer().TouchedSignal().Connect( this, &HelloWorldController::OnTouch ); | |
| 47 | 54 | } |
| 48 | 55 | |
| 49 | 56 | bool OnTouch( Actor actor, const TouchEvent& touch ) | ... | ... |