Updated documentation to ensure DALi is referenced as such.
[platform/core/uifw/dali-toolkit.git] / docs / content / shared-javascript-and-cpp-documentation / script-hello.md
1 <!--
2 /**-->
3
4  # Hello World - JSON layout{#script-hello}
5
6  The following JSON code is the minimum required to put the sentence "Hello World" on the screen.
7
8 ~~~{.json}
9 {
10  // a tree of actors
11  "stage": [{
12    "name": "text-label",
13    "type": "TextLabel",
14    "text": "Hello World",
15    "parentOrigin": "CENTER"
16  }]
17 }
18 ~~~
19
20  The following code loads the JSON file
21
22 ~~~{.cpp}
23  // C++
24  Builder builder = Builder::New();
25
26  std::string json_data(ReadFile("layout.json"));
27
28  builder.LoadFromString(json_data);
29
30  builder.AddActors( Stage::GetCurrent().GetRootLayer() );
31
32  ~~~
33
34  ~~~{.js}
35  // JavaScript
36
37  var builder = new dali.Builder();
38
39  builder.loadFromFile("layout.json");
40
41  builder.addActors( dali.stage.getRootLayer )
42
43 ~~~
44  ## Hello World - Javascript
45
46  The DALi script application is needed to run the Javascript which provides a Javascript runtime and an interface to DALi.
47
48 ~~~
49  scripting.example hello-world.js
50 ~~~
51
52  The TextLabel control to display Hello World can be constructed using Javascript dot notation accessing DALi Actor Properties.
53
54 ~~~{.js}
55 // JavaScript
56
57  var textLabel = new dali.TextLabel();
58
59  textLabel.text         = "Hello World";
60  textLabel.fontFamily   = "FreeSans";
61  textLabel.fontStyle    = "Regular";
62  textLabel.parentOrigin = dali.CENTER;
63
64  dali.stage.add( textLabel );
65 ~~~
66
67 @class _Guide_Script_Hello_World
68
69 */